People who got death penalty
Er, the firstborn child of the patriarch Judah, was killed by God for his unspecified wickedness (Genesis 38:7).
Onan, Judah's second son, was executed by God for refusing to fulfill his duty to produce children with his dead brother's widow (Genesis 38:8 - 9).
Lot's wife was immediately turned into a pillar of salt when she disobeyed the command to not view the destruction of Sodom and Gomorrah (Genesis 19:17, 26).
God personally picked Abihu and Nadab, Aaron's sons, to be special priests to him (Exodus 28:1). One day, however, they offered to the Eternal what the KJV states is "strange fire" and were immediately consumed by flames (Leviticus 10:1 - 2). Some commentaries, based on Leviticus 10:9, believe that being intoxicated while they offered incense played a role in their immediate execution.
Moses sent out twelve spies, one for each of the tribes of Israel, to scout out the Land of Canaan the Israelites were to inherit. When they returned, ten of the spies (the other two were Joshua and Caleb) gave a faithless report regarding Israel's ability to possess the land. The lack of faith among the people caused them to wander the desert for forty years. Those who brought a negative report regarding Israel's chances of possessing the promised land were killed by a plague (Numbers 14:28 - 37).
God commanded the Israelites to stone to death an unnamed man found breaking the Sabbath (Numbers 15:32 - 36).
Korah, Dathan, and Abiram, who led a rebellion against Moses and Aaron, are killed along with their families when God opens up the earth under their feet. A group of two hundred and fifty men, who offered incense and opposed Moses and Aaron, also die when fire comes from the Lord (Numbers 16).
Phinehas and Hophni served as priests who ministered at the tabernacle in Shiloh. They were the sons of Eli, who served not only as High Priest but also as a Judge of Israel. They took advantage of their positions by coercing (or forcing if necessary) those who came to offer a sacrifice to give them whatever part of the sacrificial animal they demanded (1Samuel 2:12 - 17). They also had sex with some of the women who came to the tabernacle (1Samuel 2:22). God determined that because of their sins he would slay the two evil men (1Samuel 2:25). An unnamed prophet of God later foretold the two men would die on the same day (verse 34). The Philistines, during a battle with Israel, killed both men and took from them the Ark of the Covenant (1Samuel 4:1 - 11).
Uzzah, a Levite who was helping escort the Ark of the Covenant to Jerusalem for King David, was killed instantly when he rashly tried to steady it as it traveled (2Samuel 6:7).
Jeroboam, the first king of the Northern Ten Tribes of Israel, was struck down by God because of his many sins and leading the Israelites away from the Lord (2Chronicles 13:20).
Hananiah, a false prophet who led the people to believe lies, is killed by the Eternal within a year after God sent Jeremiah to convey to him his punishment (Jeremiah 28:12 - 17).
Jehoram (also called Joram), the fifth king of the Kingdom of Judah, is stricken with a fatal bowel disease for his many sins (2Chronicles 21:18 - 19). It takes two years for him to ultimately die of the disease.
Ananias and his wife Sapphira were New Testament believers. After selling some land, they decided to give the church PART of the proceeds but make it seem that they were donating the entire amount of the sale. The apostle Peter, however, saw through their mutually agreed ruse. After confronting each one separately regarding their sin, they both immediately died (Acts 5:1 - 10).
The angel of the Lord executed Herod Agrippa I, who murdered the apostle James and tried to kill Peter, for elevating himself above mortal man (Acts 12:23).
Large groups, tribes and cities
The entire human race, except for eight people, dies when the great flood occurs. The flood came because all of man's thoughts were focused on doing evil (Genesis 6:5).
God has the tribe of Levi kill 3,000 Israelites due to the people worshipping a golden calf while Moses received the Ten Commandments on Mount Sinai (Exodus 32:26 - 28).
Because of the constant complaints from the Israelites, God kills a group of people with fire (Numbers 11:1).
Because of their whining for meat to eat, God used a plague to kill some Israelites (Numbers 11:31 - 35).
Because of their whining and complaining about not having water and not being able to eat real bread (God was feeding them with Manna), a swarm of deadly snakes kills many (Numbers 21:6).
Because Israel began to indulge in immorality and the worship of false gods, the Eternal sent a plague which killed 24,000 (Numbers 25:9).
God slays multiple thousands of people due to their looking into the Ark of the Covenant (1Samuel 6:19).
The cities of Sodom and Gomorrah are destroyed by fire from heaven (Genesis 19:24).
The firstborn of man and beast in Egypt is killed by a death angel due to Pharaoh's insistence that the Israelites stay slaves (Exodus 12:29).
The Egyptian army is completely drowned when God causes the Red Sea to go back to normal after it opened to let the Israelites cross it dry shod (Exodus 14:27 - 28).
The angel of the Lord kills 185,000 of Sennacherib's army as they await the command to enter and conquer Jerusalem (2Kings 19:35).
Ethiopian troops are killed by God as a result of King Asa of Judah's prayer (2Chronicles 14:12).
The armies of the Moabite and Ammonite tribes, Israel's enemies, are destroyed in response to King Jehoshaphat's prayer for protection (2Chronicles 20:1 - 23).
Righteous narrowly escaped wrath
Even righteous people sometimes make mistakes that can bring judgment upon themselves. The Bible discusses three incidents, one involving Moses and two involving King David, where God came close to executing these men of great faith (Hebrews 11:23 - 29, 32) for sins they committed.
Often overlooked, even by those who regularly study the Bible, is that Moses almost was KILLED by the Eternal even before he arrived in Egypt to demand the release of the Israelites! His sin was He neglected to circumcise his second son as he was commanded to do. While traveling to Egypt the Bible says "And it came to pass by the way, in the inn, that the Lord met him (Moses) and SOUGHT TO KILL HIM" (Exodus 4:24, HBFV). He was saved from death NOT because of what he did, but because his wife saw what was about to happen and circumcised the child HERSELF (verse 25 -26)! For more on this fascinating event, please read our article 'Why did God want to KILL Moses?'
David's first brush with death occurs when he is confronted by Nathan the Prophet regarding his adultery with Bathsheba and the death of her husband Uriah he arranged to cover up his sin of impregnating her (2Samuel 11, 12). Immediately after his grievous transgressions are revealed he takes responsibility for what he has done (1Samuel 12:13). Although his acts, in God's law, are punishable by the death penalty, Nathan tells the king "The Lord also has put away your sin; YOU SHALL NOT DIE" (verse 13). The implication is that David would have been put to death by God (likely immediately) had he not admitted his sin. Though not killed, he still goes on to suffer, for the rest of his life, the consequences of his error (see verses 10 - 12, 14).
David risked being killed a SECOND time when he commanded a census of the fighting men in Israel. Warned not to carry out the census by his army commander named Joab, it was a grievous sin since it was turning away from trusting God to trusting men. After the Eternal confronts him about his sin, David chooses (out of three possibilities) a three-day long deadly epidemic upon the entire land as punishment. After killing 70,000 Israelite men, the death angel carrying out this punishment is stopped by the Eternal just before entering Jerusalem (2Samuel 24). David sees the angel and pleads to God for mercy. After building an altar where the angel has stopped and offering sacrifices, the plague against the people ends. Had the angel continued his slaughter into Jerusalem, David's life would surely have been in jeopardy, if not lost, since he lived in the city.