"O daughter of Babylon, who art to be destroyed; happy shall he be, that rewardeth thee as thou hast served us. Happy shall he be, that taketh and dasheth thy little ones against the stones" (Psalm 137:8-9).
This is one of the "imprecatory psalms" as they are called (note also Psalms 5, 109, etc.). They have always been difficult to deal with in terms of Biblical inspiration. The fact remains, however, whether or not we can understand all of God's eternal purposes, "the word of the Lord is right; and all His works are done in truth" (Psalm 33:4).
We can at least make certain suggestions as to why God has included such imprecations in His Word. For one thing, they reveal, truthfully, the feelings of those who have been wronged by the enemies of God, without necessarily indicating God's approval of those feelings. The Scriptures make a distinction between those who injure us for personal reasons and those whose motivation is enmity against God. Even for the latter, however, God reminds us that "Vengeance is mine; I will repay, saith the Lord" (Romans 12:19).
With respect to the slaying of infants, as in our text, there is another factor to consider. Infant Babylonians, if brought up in the vile and cruel culture of the Babylonians of that age, who had tortured and slain God's people and desecrated and burned His temple, would almost certainly grow to be as evil as their parents. In that sense, it could well be more mercifuleven to themto take them out of the world in infancy than for them to face God's eternal wrath for their later crimes as adults. This would not lessen the guilt of those (in this case, the conquering Persians) who would later execute this judgment on Babylon.
In any case, we must never allow difficulties for which we do not yet have answers to cause us to question the integrity of God and His Word. HMM