Genesis 38:9-10
Genesis 38:9-10 NASB1995
Onan knew that the offspring would not be his; so when he went in to his brother’s wife, he wasted his seed on the ground in order not to give offspring to his brother. But what he did was displeasing in the sight of the LORD; so He took his life also.