Genesis 38 is about contraception:
Bottom line is that God killed Onan for some reason. The only plausible reason we have from the text itself is contraception. A straightforward reading of the text lends itself readily to that interpretation (though not absolutely of logical necessity).[source]Genesis 38 is not about contraception:
"In the case of Onan, you are right that the common Catholic reliance on this passage as a proof text against contraception or masturbation is a weak one and wrong-headed" [Source: Mark Shea. What Does it Mean to Say Jesus has Fulfilled the Old Covenant?].
Hat tip: Catholic Champion. Good catch Matthew.