When Er died, the custom of yibbum — levirate marriage — required his brother Onan to marry Tamar and father a child who would legally carry Er's name and inherit Er's portion. The future Torah would codify this duty explicitly (Deuteronomy 25:5). In Genesis 38, it is already an ancestral practice.

Targum Pseudo-Jonathan on (Genesis 38:9) makes Onan's calculation brutally clear. Onan knew that they would not call the children after his name, and it was, when he entered to the wife of his brother, that he corrupted his work upon the earth, that he might not raise up children to his brother's name.

Onan did not refuse to marry Tamar. He did not refuse to live with her. He refused only the one thing the marriage was for: fathering a child who would bear his dead brother's legacy. The sages called this shichchat zera — the wasting of seed — and connected it to his brother Er's earlier sin. Two brothers. Same wife. Same refusal. Different reasons.

Er did it for vanity. Onan did it for inheritance. If Tamar bore a child officially named after Er, that child would inherit the firstborn's double portion — land that would otherwise revert to Onan. Onan married the widow to keep the estate and sabotaged the marriage to keep it forever.

The Targum places Onan's motive starkly on the page so that no one can mistake it for religious scruple. This was greed, not reverence. God's judgment on Onan was swift — and the pattern was set for Tamar, twice widowed, to take matters into her own hands. The Messianic line would not be stopped by two selfish brothers. It would find its way through a daughter-in-law at a crossroads, wearing a veil, demanding what Judah's family had refused to give.