There are many passages that imply God has or will punish, directly or indirectly. This is far from an exhaustive list.
Hosea 10:10, 14
10 When I please, I will punish them; nations will be gathered against them to put them in bonds for their double sin.
14 ......when mothers were dashed to the ground with their children.
Isaiah 35:4 Say to those with fearful hearts, “Be strong, do not fear; your God will come, he will come with vengeance; with divine retribution he will come to save you.”
Now kill all the boys. And kill every woman who has slept with a man, but save for yourselves every girl who has never slept with a man.(Numbers 31:17-18)"
1 Samuel 15:2-4
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. 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.
Assyria to be used to punish Judea – Gods instrument to punish.
Isaiah 10:5 Woe to Assyria, the rod of My anger-the staff in their hands is My wrath.
Amos 3:13-15 - 13 “Hear this and testify against the descendants of Jacob,” declares the Lord, the LORD God Almighty. 14 “On the day I punish Israel for her sins, I will destroy the altars of Bethel; the horns of the altar will be cut off and fall to the ground. 15 I will tear down the winter house along with the summer house; the houses adorned with ivory will be destroyed and the mansions will be demolished,” declares the LORD.
Amos 4:2
2 The Sovereign LORD has sworn by his holiness: “The time will surely come
when you will be taken away with hooks, the last of you with fishhooks.
Micah 1:6 “Therefore I will make Samaria a heap of rubble,
Micah 15:5 I will execute vengeance in anger and fury on the heathen, such as they have not heard.
Ezekiel 23:45-48 (King James Version)
45: And the righteous men, they shall judge them after the manner of adulteresses, and after the manner of women that shed blood; because they are adulteresses, and blood is in their hands.
46: For thus saith the Lord GOD; I will bring up a company upon them, and will give them to be removed and spoiled.
47: And the company shall stone them with stones, and dispatch them with their swords; they shall slay their sons and their daughters, and burn up their houses with fire.
48: Thus will I cause lewdness to cease out of the land, that all women may be taught not to do after your lewdness.
If in spite of this you still do not listen to me but continue to be hostile toward me, 28 then in my anger I will be hostile toward you, and I myself will punish you for your sins seven times over. 29 You will eat the flesh of your sons and the flesh of your daughters."(Leviticus 26:27-30)
"Happy shall he be, that taketh and dasheth thy little ones against the stones." (Psalm 137:9)
"For whatsoever man he be that hath a blemish, he shall not approach: a blind man, or a lame, or he that hath a flat nose, or any thing superfluous, Or a man that is brokenfooted, or brokenhanded, Or crookbackt, or a dwarf, or that hath a blemish in his eye, or be scurvy, or scabbed, or hath his stones broken. No man that hath a blemish of the seed of Aaron the priest shall come nigh to offer the offerings of the Lord made by fire: he hath a blemish; he shall not come nigh to offer the bread of his God." (Leviticus 21:18-21)
NOT ONLY in the OT
Matt 10:34 34 Do not suppose that I have come to bring peace to the earth. I did not come to bring peace, but a sword. 35 For I have come to turn a man against his father, a daughter against her mother, a daughter-in-law against her mother-in-law – 36 a man’s enemies will be the members of his own household.” (Matthew 10: 34-36)
“But those enemies of mine who did not want me to be king over them, bring them here and kill them in front of me.” (Luke 19:27)
“the Son of man will appear in the sky, and all the nations of the earth will mourn” (Matthew 24:30)
1 Corinthians 15:24 [Jesus] will turn the Kingdom over to God the Father, having destroyed every ruler and authority and power.
15:25 For Christ must reign until he humbles all his enemies beneath his feet.
Luke 12:49 - “I have come to bring fire on the earth, and how I wish it were already kindled!
All who would not seek the LORD, the God of Israel, were to be put to death, whether small or great, man or woman. (2 Chronicles 15:13)
Revelations 2:23 And I will kill her children with death; and all the churches shall know that I am he which searcheth the reins and hearts: and I will give unto every one of you according to your works.
Revelation 19:11-21 describes the ultimate war with Christ, the conquering commander who judges and makes war “with justice” (v. 11). It’s going to be bloody (v. 13) and gory. The birds will eat the flesh of all those who oppose Him (v. 17-18). He has no compassion upon His enemies, whom He will conquer completely and consign to a “fiery lake of burning sulfur” (v. 20).
“every tribe on earth will mourn because of him” (Rev. 1:7)
Rev 12:5 5 She gave birth to a male child, one who is to rule all the nations with a rod of iron, but her child was caught up to God and to his throne,
“judge and wage war” (Rev. 19:11)
his robe will be “dipped in blood” (19:13)
(Revelations 2:23) And I will kill her children with death; and all the churches shall know that I am he which searcheth the reins and hearts: and I will give unto every one of you according to your works.
Conclusion
God will punish those who go against his Law / commandments as they have caused corruption in the society. The only issue that appears at odds is the unwarranted killing of children and babies as they are innocent and God would not punish the innocent.