In the Old Testament times, particularly early on in the time described from Genesis to Deuteronomy, there is no evidence of God promoting the concept of an afterlife. God would often kill people that transgressed His moral code, even if the code had not previously or officially been made known.
In our justice system, we consider it necessary to have a law written in the books before someone can be convicted. It does create some unfortunate loopholes, but it also prevents abusive and capricious executions of the law.
Should you have to worry about abusive and capricious executions of God's Law? Is God's justice perfect? Those are a couple questions we examine in this post.
Imagine that you could just use the might of your willpower to kill someone, like a psycho-kinetic super sniper. Would you do it? If so, to whom? Osama bin Laden? Mahmoud Ahmadinejad? The jerk down the road that regularly treats his wife like a punching bag?
In Genesis 38:1-10, we find two cases where God plays the role of Super Sniper. These guys had to be pretty bad, right? Let's take a look. The first precision death is Er. According to Genesis 38:7:
But Er, Judah's firstborn, was wicked in the LORD's sight; so the LORD put him to death. NIVHmmm. He was wicked. That's it. Not much to go on. It's unfortunate that there are no details. You can't learn from Er, other than to try to avoid being wicked.
Moving on. Er had been married to Tamar before his untimely (or was it timely?) death. At the time of his death, Er hadn't had any children to grant his inheritance. So the responsibility of making an heir for Er would then fall to Onan, Er's brother. According to Genesis 38:8-10:
Then Judah said to Onan, "Lie with your brother's wife and fulfill your duty to her as a brother-in-law to produce offspring for your brother." But Onan knew that the offspring would not be his; so whenever he lay with his brother's wife, he spilled his semen on the ground to keep from producing offspring for his brother. What he did was wicked in the LORD's sight; so He put him to death also. NIV(As an aside to the main discussion, these verses are often used by some Christians to support the believe that birth control is a sin. However, when put in context, it seems to me the sin here is Onan's deceptive intent; to just have sex with Tamar without producing a child for his fun and ultimate financial gain, as Er's inheritance would likely pass to his lineage by default without an heir for Er.)
I can't deny that Onan was guilty of wrong doing. While there was no God-given law at that time stating that what Onan did was prohibited, or worthy of death for that matter, I think that it is safe to say that Onan was dishonest, and that his intent was to promote his selfish interests unscrupulously.
God killed Onan. God killed Onan for being selfish. Why?
When you read through history's list of the most infamous people; sadistic serial killers, notorious criminals, villainous dictators, etc., you have to wonder why God wouldn't have stepped in and snuffed these people out personally before they went on to negatively impact the lives of tens, or thousands, or even millions of people. Instead, God choses to kill someone that spilled semen on the ground.
It has been said that it is a matter of free will. God wants us to be able to chose good, but that also permits the choice of evil. Because of this free will, evil may be very evil indeed.
Well then, what about Onan's free will? And did the removing of Onan from humanity make the world a much better place in the end? Not really. Instead, it created the misguided doctrines of birth control being a sin and sex being only for procreation. Does God consistently kill people that have sex for selfish reasons? No.
Selective executions could be used for good without tampering with free will. If God had snuffed out Hitler with a heart attack shortly after he came to power, His chosen people, the Jews, would not have suffered an attempted genocide. And I guarantee that the free will of the general public would not have been altered in one bit. There would still be people choosing evil or choosing good, or more probably a little of both. The net result, however, would be that tens of millions of people would have been saved from untimely deaths, not to mention all of those that were wounded or lost their loved ones.
God executes Er and Onan, but God does not consistently execute all wicked people. In fact, God has chosen not to execute some of the most infamously wicked people throughout history; people that make Onan's sin look like an act of charitable goodwill. This is capricious justice at best, and capricious justice is not justice at all.
Personally, my take on this is that it's a record of superstition, not some act of God. Back in those times, people had little-to-no idea what caused death if there was no blatant reason, like old age or being gored by an ox. If Er and Onan were real people, they probably just died from heart attacks, or aneurysms, or some other physical reasons which would have been undetectable at that time. But because these deaths could not be explained, they were instead deemed as being deaths from God.