But Onan knew that the offspring wouldn't be his own heir, so whenever he had sexual relations with his brother's wife, he would spill his semen on the ground to avoid fathering offspring for his brother. 