Genesis 38:6-11 (NJPS):
Judah got a wife for Er his first-born; her name was Tamar. But Er, Judah’s first-born, was displeasing to the Lord, and the Lord took his life. Then Judah said to Onan, “Join with your brother’s wife and do your duty by her as a brother-in-law, and provide offspring for your brother.” But Onan, knowing that the seed would not count as his, let it go to waste whenever he joined with his brother’s wife, so as not to provide offspring for his brother. What he did was displeasing to the Lord, and He took his life also. Then Judah said to his daughter-in-law Tamar, “Stay as a widow in your father’s house until my son Shelah grows up”—for he thought, “He too might die like his brothers.” So Tamar went to live in her father’s house.
So Er died for "displeasing" the Lord and Onan died for "displeasing" the Lord too. While we don't know what Er did, we can see what Onan did in the bolded section. I've seen this interpreted as a condemnation of:
- Theft of Tamar's child
- In-chastity within marriage (this option is confusing to me)
- Not performing his Levirate duty
I wouldn't be surprised if there were other interpretations. But what, if anything, does the text say Onan did wrong? Is it possible to draw a larger principle from this passage?