Gen 38:9

38:9 so as not to give offspring to his brother. Because the deceased Er was the firstborn, his heir would have inherited his position of family leadership and double portion (37:11 note). Desiring the place of firstborn for himself, second-born Onan (v. 4) had intercourse with Tamar but prevented conception of a child. In so doing he was unfair to both his deceased brother and Tamar.