Onan restrained God’s will, so He killed him.
Abraham and Sarah were in their 90's, way past menopause, when Sarah was first pregnant.