Old Testament
> Genesis >
Er and Onan

 Genesis 38:9
But knowing that the child would not be his, whenever Onan had sex with his brother's wife, he would spill his semen on the ground to avoid giving offspring to his brother.