I never heard it being a sin for spilling the seed..
What about birth control ( condom). Or "pulling out"?
Or what if I had a vasectomy?
Does the following mean it was a sin to do so?
In the old testament?
I am not so sure that the spilling of the spilling of the seed but it could be the reason why.
Genesis 38:8-10
8 And Judah said to Onan, “Go in to your brother’s wife and marry her, and raise up an heir to your brother.” 9 But Onan knew that the heir would not be his; and it came to pass, when he went in to his brother’s wife, that he emitted on the ground, lest he should give an heir to his brother. 10 And the thing which he did displeased the Lord; therefore He killed him also.
NKJV Study notes.
38:8 to your brother’s wife: In the ancient Middle East, for a man to die without leaving a son was regarded as an incalculable loss. A person’s memory was preserved in his descendants. In order to maintain the family line and the name of the deceased, a brother or another near relative would marry the man’s widow and father a child that would carry on the man’s family. This is called levirate marriage, from a Latin word meaning “husband’s brother.” The custom became part of the Mosaic Law (Deut. 25:5–10; Ruth 4:1–12).
38:9 emitted on the ground: Because of his own selfishness and wicked attitude toward his deceased brother, Onan would not allow his brother’s widow to conceive a child. He feared the child would perpetuate the name of his brother Er and not his own.
38:10 The Lord judged Onan, just as He judged Er (v. 7).