Incorrect.
See
tinyurl.com/nd324ej
Answer by Fr. John Echert (EWTN) on May-14-2006:
Extracts:
“The account of Onan’s refusal to carry out the obligation to raise up children in place of his brother is found in Genesis 38.
“By the ancient custom–later to become the law of God in the time of Moses–in order that the family name would live on through a man’s descendants, if a brother died leaving a widow and no sons, then it was the duty of his brother to take his widow as his own and produce offspring from the relationship. Onan not only failed to fulfill this command of God, but committed an additional violation of the law of God by spilling his seed on the ground, that is, withdrawal during the act of sexual intercourse. His sin was twofold and showed contempt for God and nature. Incidentally, this biblical account is important to keep in mind in the whole matter of contraception which is against the law of God and nature. Sexual intercourse is intended to be fruitful and one must have at least the openness to the possibility of new life; Onan showed contempt for life and law.
‘There are some who argue that the severe punishment of God upon Onan was for his failure to fulfill the Levirate law of raising up offspring; however, the punishment for this was specified by God as recorded in the book of Deuteronomy:
25:5 "If brothers dwell together, and one of them dies and has no son, the wife of the dead shall not be married outside the family to a stranger; her husband’s brother shall go in to her, and take her as his wife, and perform the duty of a husband’s brother to her. 25:6 And the first son whom she bears shall succeed to the name of his brother who is dead, that his name may not be blotted out of Israel. 25:7 And if the man does not wish to take his brother’s wife, then his brother’s wife shall go up to the gate to the elders, and say, —My husband’s brother refuses to perpetuate his brother’s name in Israel; he will not perform the duty of a husband’s brother to me.’ 25:8 Then the elders of his city shall call him, and speak to him: and if he persists, saying, – I do not wish to take her,’ 25:9 then his brother’s wife shall go up to him in the presence of the elders, and pull his sandal off his foot, and spit in his face; and she shall answer and say, – So shall it be done to the man who does not build up his brother’s house.’ 25:10 And the name of his house shall be called in Israel, The house of him that had his sandal pulled off.”
“**The penalty imposed by Mosaic Law was not a death sentence upon the guilty brother but public humiliation–a far cry from execution. This leads us to conclude that the death punishment upon Onan was not for his failure to raise up posterity for his deceased brother, but for the crime of wasting the seed upon the ground – a primitive and vulgar form of contraception. **Incidentally, with regards to contraception, many people today are ignorant of the fact that many forms of contraception actually act as an abortifacient – they kill the newly conceived child in some manner.” [My emphasis].