6-7Judah got a wife for Er, his firstborn. Her name was Tamar. But Judah's firstborn, Er, grievously offended God and God took his life.
8-10So Judah told Onan, "Go and sleep with your brother's widow; it's the duty of a brother-in-law to keep your brother's line alive." But Onan knew that the child wouldn't be his, so whenever he slept with his brother's widow he spilled his semen on the ground so he wouldn't produce a child for his brother. God was much offended by what he did and also took his life.