Onanism is an act Onan committed when he was commanded by God to fulfill his brotherly duties with his dead brother's wife under the rules of Levirate marriage. Onan circumvented the process of reproduction. Onan was killed by God for committing his disobedient act (Genesis 38:7-10).
Whether the act of onanism is a sin is subject to dispute, as onanism is a commonly used birth control method also called coitus-interruptus or withdrawal. The Roman Catholic Church and other popular sources interpret this passage as a condemnation of sexual intercourse which does not permit reproduction. Thus, the Roman Catholic Church considers onanism (including self abuse) to be sinful. The traditional Jewish view of the Biblical passage suggests that Onan's sin may have been in disobeying an order from God, or even the lack of putting the family needs before his own.