But Onan knew that the offspring would not be his. So whenever he went in to his brother’s wife he would waste the semen on the ground, so as not to give offspring to his brother.
Here is, 1. Judah's foolish friendship with a Canaanite-man. He went down from his brethren, and withdrew for a time from their society and his father's family, and got to be intimately acquainted with one Hirah, an Adullamite, Gen 38:1. It is computed that he was now not much above fifteen or sixteen years of age, an easy prey to the tempter.
Commenting on Genesis 38:1-11
And the thing which he did displeased the Lord,.... Being done out of envy to his brother, and through want of affection to the memory of his name; and it may be out of covetousness to get his estate into his own hands, and especially as it frustrated the end of such an usage of marrying a brother's wife; which appears to be according to...
Onan knew that the seed should not be his - That is, that the child begotten of his brother's widow should be reckoned as the child of his deceased brother, and his name, though the real father of it, should not appear in the genealogical tables.