There was a question about this on an EWTN forum a while back. Whereas most of the teaching against contraceptives come from a fairly straightforward understanding of the word "Use" under the Natural Moral Law. There is a straightforward Biblical Basis
Given the widespread contraceptive practice of the first century, euphemistically referred to as "using magic" and "using drugs," it is logical to see in the New Testament prohibition of "mageia" and "pharmakeia" an implicit condemnation of contraception. This is especially true in the context of Galations 5:20 and Revelation 21:8,22:15, which refer to sins against chastity.
The gist of it is, one of the magic arts used, that had very practical effects, was that which induced abortion. As Arthur C. Clarke said, more-or-less, any science that is too hard to understand most people think of as magic, so it makes plenty of sense to consider any provision against magic, especially magic potions, as an injunction against contraception.
idolatry and witchcraft; hatred, discord, jealousy, fits of rage, selfish ambition, dissensions, factions
Gal 5:20 - NIV
But the cowardly, the unbelieving, the vile, the murderers, the sexually immoral, those who practice magic arts, the idolaters and all liars—they will be consigned to the fiery lake of burning sulfur. This is the second death.”
Rev 21:8 - NIV
Outside are the dogs, those who practice magic arts, the sexually immoral, the murderers, the idolaters and everyone who loves and practices falsehood.
Rev 22:15 - NIV
Now, the crime Onan committed also was contraception, in that he deliberately prevented conception. People conflate that with masturbation too, which isn't a stretch, but lots of Christians who consider contraception sinful also consider masturbation sinful and I can never remember which one is more grave (I've read arguments either way, and I think it depends on what you're doing and who you're doing it with), so it's best to just just avoid them both.