Judah has two sons who disobey God’s laws. Even though they had no written law, there seem to be very established laws anyway. For instance, it was wrong to have another man’s wife, and everyone knew it.
The sons of Israel knew it was right to give your brother an heir if he died without one. I don’t know why it came to be that both of Judah’s sons were evil. We know he was the one with the bright idea to sell Joseph into slavery. He wasn’t all upright himself.
God kills both of those evil sons. Judah does not recognize God’s judgment, meaning the deservedness of their deaths. He does have another son, but he fears for his life and won’t give him to Tamar, the unfortunate widow of the evil men, who ends up being a great, great, … grandma to Jesus.
Why do bad things happen? Why do people die?
Here we read specifically that they died for their evil deeds. This is what we call God’s wrath, His final judgment on a situation. Most of His wrath is stored up for the end when He will judge those in the world and finally destroy the whole world. Most of what we see on the earth is Satan at work. He steals, kills, and destroys. He is always looking for an opening to do his job.
Some he freely works through. Others he cannot get near without permission. Why would God grant permission? We see at the beginning of Job that God is pleased with Job. He’s a proud papa. He’s not pronouncing judgment or pouring out wrath. At the end of Job, we see that Job has learned something along the way. And Job has been a blessing to billions who come after him.
In the gospels, people assume bad things happen because of sin. Jesus pronounced some people’s conditions were not at all a result of sin but they were for God’s glory. Those people experienced God in a deep and meaningful way that transformed their lives. Jesus and the epistles show us that sickness can result from sin (ex. John 5:14, 1 Cor. 11:30). It can result in God’s glory even then, though, as it can turn us back to God.
So, what can we learn? No matter what, we obey God. No matter what, we seek God’s glory. We’re safe in His capable hands to submit to pruning, no matter how much it looks like a cutting away. For a believer, it will end up for our good.