A common misinterpretation of Genesis 38:10 is that it universally condemns masturbation, contraception, or any form of coitus interruptus as inherently sinful, often cited to oppose birth control; however, the passage specifically addresses Onan's wicked motive of shirking his duty under the levirate custom to evade providing an heir that would not legally be his, rather than the physical act itself, as evidenced by the narrative context where his primary sin was selfishness and defiance against God's intent for the family line.
Genesis 38:10
King James Version (1769)
10 And the thing which he did displeased the Lord: wherefore he slew him also.
Genesis 38:10 highlights God's displeasure with Onan's deliberate refusal to fulfill his levirate responsibility to produce an heir for his deceased brother Er through Tamar, choosing instead to selfishly preserve his own inheritance by spilling his seed on the ground; this act of disobedience and disregard for familial and divine order led to divine judgment upon him, underscoring the seriousness of rejecting God's covenantal provisions for family continuity and righteousness.