Ancient pagan belief held that there was great spiritual power to be obtained over one's enemies by sacrificing one's own children. So when a city was under seige, the inhabitants would go on to the city walls and, in the sight of the attacking army, sacrifice a child or baby to the city god.
That is why God warned the Israelites not to become sympathetic to the pagan nations, not to marry into them and not to adopt their practices. That is why Joshua pronounced a curse on anyone rebuilding the city walls of Jericho after God brought the walls down: 'At the cost of his firstborn son will he lay its foundations; at the cost of his youngest will he set up its gates.' That is why, much later, the Bible records, 'In Ahab's time, Hiel of Bethel rebuilt Jericho. He laid its foundations at the cost of his firstborn son Abiram and he set up its gates at the cost of his youngest son Segub, in accordance with the word of the Lord spoken by Joshua' (1 Kings 16:34).
Hiel defied God's chosen way of reminding Israel of his gift of the Promised Land to them, as punnishment on the 400 years wickedness of its previous pagan inhabitants. The loss of his two sons was most likely Hiel succumbing to pagan practices as Ahab and Jezebel's rule had brought paganism into Israel.
Because people today think of themselves as, 'Oh so sophisticated and educated' and utterly removed from barbaric brutality, we try to sanitise killing of the innocents by speaking of them as fetuses (not babies) and being 'pro-choice' (not murderers). People even accuse God of being a murderer because He did not stop wicked Herod slaughtering children at the time of Christ's birth! Well, he doesn't stop people mocking and cursing Him either. He allows us to make our choices - and to live with the consequences. Fair enough, surely? Or do the God-taunters gain a feeling of power over God with freedom to abort, and do they want to kill God too, claiming they've silenced Him? Remember Hiel.