NET Bible
"Then Judah said to Onan,“Sleep with your brother’s wife and fulfill the duty of a brother-in-law to her so that you may raise up a descendant for your brother.”"
— Genesis 38:8, NET Bible
“And Judah said unto Onan, Go in unto thy brother’s wife, and marry her, and raise up seed to thy brother.”
Then she had yet another son, whom she named Shelah. She gave birth to him in Kezib.
Judah acquired a wife for Er his firstborn; her name was Tamar.
But Er, Judah’s firstborn, was evil in the LORD’s sight, so the LORD killed him.
Then Judah said to Onan,“Sleep with your brother’s wife and fulfill the duty of a brother-in-law to her so that you may raise up a descendant for your brother.”
But Onan knew that the child would not be considered his. So whenever he slept with his brother’s wife, he wasted his emission on the ground so as not to give his brother a descendant.
What he did was evil in the LORD’s sight, so the LORD killed him too.
Then Judah said to his daughter-in-law Tamar,“Live as a widow in your father’s house until Shelah my son grows up.” For he thought,“I don’t want him to die like his brothers.” So Tamar went and lived in her father’s house.