Speak to the people of Israel and say to them, When you pass over the Jordan into the land of Canaan, then you shall drive out all the inhabitants of the land from before you and destroy all their figured stones and destroy all their metal images and demolish all their high places.
God wanted the idolatry of the Canaanites eradicated. Israel was supposed to do this fully when they moved into the Promised Land. God warned them that if they did not obey Him in this matter, idolatry would lead to their own regrettable demise (see Numbers 33:55-56).
By now in the story, this generation of Israel should have had ample opportunity to have this taught to them. They had grown up with the Ten Commandments. The first two of these explicitly deal with the exclusivity of a relationship with God and forbid any semblance of idolatry (Exodus 20:3-6). They had seen their parents flagrantly disobey with the golden calf. They had seen the more recent Midianite flirtation with idolatry and sexuality and how it devastated the camp. This warning was quite real.
The propensity of the human heart for idolatry is enormous. We always want to make our own god that we can control. We want tangible gods with tangible results. And this is not just an Old Testament warning. The apostle John warns us today of the idol-making and idol-following ways of the human heart (1 John 5:21). Left to myself, my heart is an idol-making factory looking for something other than God to worship. I have to shut it down in real worship and obedience to God my Father!