The first child sacrifice was a near miss: Abraham’s hand was stayed and Isaac got to grow up. It was the first concrete sign of God’s disapproval of child sacrifice. It was a message of Even if you think I want you to kill your child, I really don’t.
The next mention was in Leviticus, when God gave the Israelites’ their new moral code. It included a ban on child sacrifice, initially to one idol:
Leviticus 20:2-4 If any of them offer their children as a sacrifice to Molech, they must be put to death. The people of the community must stone them to death. I myself will turn against them and cut them off from the community, because they have defiled my sanctuary and brought shame on my holy name by offering their children to Molech.
But by the second reading of the Law, it was broadened to any child sacrifice:
Deuteronomy 12:31You must not worship the Lord your God the way the other nations worship their gods, for they perform for their gods every detestable act that the Lord hates. They even burn their sons and daughters as sacrifices to their gods.
The very idea of child sacrifice more broadly was (and still is) repugnant. God called it a horrible deed, and it was always related to idolatry:
Jeremiah 32:35 They have built pagan shrines to Baal in the valley of Ben-Hinnom, and there they sacrifice their sons and daughters to Molech. I have never commanded such a horrible deed; it never even crossed my mind to command such a thing. What an incredible evil, causing Judah to sin so greatly!
Just before the fall of the northern kingdom of Israel to Assyria, God swept them away from His presence for:
2 Kings 17:17 [The northern Isralites] even sacrificed their own sons and daughters in the fire .
The condemnation of child sacrifice was part of God’s condemnation of Judah (Isaiah 57:5) and, later, Jerusalem:
Ezekiel 20:31 For when you offer gifts to them and give your little children to be burned as sacrifices, you continue to pollute yourselves with idols to this day. Should I allow you to ask for a message from me, O people of Israel? As surely as I live, says the Sovereign Lord, I will tell you nothing.
The exile to Babylon came not long afterwards.
The sacrificial system was partly built around avoiding human sacrifice at all, with animals taking the place of human sacrifice.