There were times in a war against certain peoples that this was commanded
1 Sam 15:1 Samuel also said unto Saul, The LORD sent me to anoint thee to be king over his people, over Israel: now therefore hearken thou unto the voice of the words of the LORD.
1 Sam 15:2 Thus saith the LORD of hosts, I remember that which Amalek did to Israel, how he laid wait for him in the way, when he came up from Egypt.
1 Sam 15:3 Now go and smite Amalek, and utterly destroy all that they have, and spare them not; but slay both man and woman, infant and suckling, ox and sheep, camel and ass.
Not that Saul fully performed it, sparing the King for which he was rebuked, and that s where the prophet Samuel did Saul's Job for him.
1 Sam 15:33 And Samuel said, As thy sword hath made women childless, so shall thy mother be childless among women. And Samuel hewed Agag in pieces before the LORD in Gilgal.
But there it is clear it was an eye for an eye, when it come to the reasons for doing so, and so it would be done to them in return.
Or for example here when rebelling against God
Hosea 13:16 Samaria shall become desolate; for she hath rebelled against her God: they shall fall by the sword: their infants shall be dashed in pieces, and their women with child shall be ripped up.