Moses had a lot to say before he died and the Israelites invaded Canaan. Part of that was to go over the first part of the Law given some 40 years earlier, the ten commandments:
Deuteronomy 5:6-21I am the Lord your God, who rescued you from the land of Egypt, the place of your slavery.
1. You must not have any other god but me.
2. You must not make for yourself an idol of any kind …
3. You must not misuse the name of the Lord your God …
4. Observe the Sabbath day by keeping it holy …
5. Honor your father and mother …
6. You must not murder.
7. You must not commit adultery.
8. You must not steal.
9. You must not testify falsely against your neighbor.
10. You must not covet … anything … that belongs to your neighbour.
On the second commandment, there was a serious penalty for idol worship, which was set as equal to rejecting God. There was an even more serious blessing promised for not worshipping idols:
Deuteronomy 5:9 I lay the sins of the parents upon their children; the entire family is affected—even children in the third and fourth generations of those who reject me. But I lavish unfailing love for a thousand generations on those who love me and obey my commands.
It was all part of His covenant with the Israelites, as first made with Abraham.