The tragic slide into idolatry creates a deep moral and spiritual distortion, where sacred acts meant to elevate a person are twisted into sources of impurity. Instead of dedicating their firstborn children, those who first open the mother's womb, to God, the people offered them as sacrifices to the idol Molech [מצודת דוד, מצודת ציון].
Because of this betrayal, God allowed their own offerings to become a source of defilement. The commentators offer different perspectives on how this unfolded. One approach suggests that God simply handed the people over to their own destructive desires. The very laws and gifts originally given to sanctify the firstborns to God were corrupted by the people into idolatrous practices [רש״י, ביאור שטיינזלץ].
Other commentators view this defilement as a profound distancing. Since the people chose to offer their gifts to false gods, God pushed them away, treating them as something impure and rejecting them from His protective shelter [רד״ק, מצודת דוד, אברבנאל]. This severe distancing is specifically linked to the tragic events of Baal Peor [רד״ק].
Adding a psychological dimension, [מלבי״ם] explains that the value system of the people became completely inverted. Because they were so entrenched in idol worship, they began to view the horrific act of sacrificing their children to Molech as something holy. Conversely, they viewed the actual commandments of God as something impure and bad, believing that following His laws would strip them of their false sense of holiness.
The consequence of such deeply rooted corruption is severe destruction and terror [רש״י, רד״ק, מצודת ציון, מלבי״ם]. God brings desolation and exile upon the people. This devastation sometimes arrived immediately on the heels of the sin, such as the plague that struck down twenty-four thousand people [רד״ק].
However, this destruction is never the final goal. The punishment serves a dual purpose, moving from initial desolation toward an ultimate spiritual awakening. The true value of the exile and devastation is that, specifically through their distress, the people will finally recognize the true God. They will understand that the gods of the surrounding nations are entirely false, leading them to ultimately return to Him at the end of days [מצודת דוד, מלבי״ם, אברבנאל].