The Torah says Er, Judah's firstborn, was evil in the eyes of the Lord, and the Lord slew him. Readers have wondered for centuries: evil in what way? Targum Pseudo-Jonathan on (Genesis 38:7) gives a surprising and very specific answer: because he had not given his seed unto his wife.
Er had married Tamar, the future mother of kings. But he refused to have children with her. The sages explained the motive: Er was vain about Tamar's beauty and did not want her body damaged by pregnancy (Yevamot 34b). He preferred her as ornament to her as mother.
This is, in the Torah's eyes, a total inversion of the purpose of marriage. The very first mitzvah given to humanity was be fruitful and multiply (Genesis 1:28). A marriage that refuses children in the name of preserving the wife's appearance is a marriage built to destroy what marriage exists to build. Er was using Tamar. He was also robbing the Messianic line before it knew it existed — because Tamar, one way or another, would become the ancestress of David.
The Targumist does not soften the verdict. The anger of the Lord prevailed against him, and the Lord slew him. This is one of the very few places in Genesis where God directly kills an individual for personal sin. The directness is the point. Er had not oppressed a stranger, not worshipped an idol, not spilled blood. He had twisted the most intimate institution in human life into something sterile and ornamental.
And the same sin, the Targum will tell us in the next verse, would be committed by Onan, Er's brother — because some patterns repeat until someone breaks them. Tamar, at the crossroads, would eventually break this one.