There are many layers here. The heart of the matter is that he was having sex with a woman, and chosing deliberately to use coitus interuptus as contraception. He didn't want to have a child by this particular woman. He was vain, selfish, and seeking to please himself while decieving everyone else.
Bottom line, then is that Onan's sexual act, as such is condemned as sinful in Gen. 38:9-10 and this was the interpretation held not only by the Fathers and Doctors of the Roman Catholic Church, but also by the Protestant Reformers, and by nearly Christian denominations until the early years of this century. Then why aren't there gazillions of teenaged boys getting zapped today, you ask? See, I really can read your mind! There are times God lets people make their own choices and their own mistakes, and there are times God makes an example of the sinner and punishes him for all to see and learn from. The lesson once given, and recorded, why give it again and again? Like Jesus said in His parable about the rich man, and Lazarus, it's written in Scripture, all we have to do is follow it. We don't need special miracles or messengers.Check back now and then for new articles, or sign up for the Serendipity Mailing List and discuss these and many more issues of the Church and Christian life.