Now, since I was taught as a Catholic, albeit now somewhat laissez-faire, I thought I knew this sort of thing; but since there seemed to be some question, I decided to take matters into my own hands and do some research.
Turns out, the events leading up to the sin that our guy Onan committed were as follows: God, I guess in a fit of divine peak, smote Onan's older brother - smote him dead. His name was Er, but that's not important now. Er was married, though, and that's where the fun starts. Turns out back then, there was a custom called Levirate marriage - if your brother died (or was, you know, smote dead), and his now widowed wife was childless, you (or one of your brothers) were expected to step up to that plate and continue the line of the dead husband.
I'm pretty sure that the whole concept of Levirate marriage explains why there are so many members of the Kennedy family.
Anyway, Onan's father tapped Onan to tap the widow, Tamar, so that (under the terms of Levirate marriage) her kids would be legally Er's kids. Onan decided that since the kids would really be his, but legally they'd be his dead brother's, he just wasn't down with that. So, when he, ahem, the scripture says that when he went into her, he ensured that there would be no children from the union by pulling out and "spilling his seed upon the ground."
Seems to me Onan's real sin was in trying to have his cake and eat it too - he didn't want kids, but he wasn't going to turn down a nice piece of tail like Tamar, either. So she feels used, tells the Lord, and the Lord God Almighty done smote Onan too. Must have been in quite a mood. So much for maintaining the bloodline.
(It seems worth noting that I'm pretty sure I saw this whole scenario played out on General Hospital back in the '80s - Bobby and Jack and Anna and I forget who all else, with dead brothers and sex with the in-laws and babies raised by the natural father who was really the uncle... Did they lift that straight from Genesis? Does God hold copyright on that stuff?)
So it turns out the Scripture is open to debate. Was Onan killed by God because he dissed Tamar instead of standing to stud as a surrogate for his dead brother, or was he killed because of the way in which he dissed her – coitis interruptus, wasting his seed upon the ground. (More likely upon the sheets.) The answer is, scholars have pondered and continue to debate this issue today – right now, master debaters are handling this issue – and there’s evidence to support both sides.
The most interesting article I found – and you can find some very interesting things Googling words like “masturbation” and “church” in the same search – was a very well written, thoughtful, and detailed explanation of how to go about giving your boyfriend a blowjob in the church in which you were baptized and received first confession and first communion. It was so detailed and, well, explicit that I promptly committed the sin of Onan.
And yet God has not said a word!