Whether or not we obey God's laws and the teachings of His Church is up to each of us. The problem reduces itself to: how much do we love God and how much do we value our own souls and the souls of others?
The is no biblical injunction against contraception. It's a church-made law by a (supposedly) celibate priesthood. That was my original point and it is still my point.
Talk about quoting the Bible out of context. Onan's sin has nothing to do with "contraception" as we understand it and about refusing to take care of his late brother's widow. He wanted to pretend he was doing his brotherly duty to Er. Onan sexually abuse Tamar (in a manner of speaking) because he didn't have the guts to simply tell Judah, "No. I won't take Tamar." It was about Onan's greed and his desire to save face that brought about G-d's wrath.
To interpret this text to apply to a married couple's mutual decision to not have children or to delay having children is spurious at best.
David Guzik's Commentaries on the Bible elaborates further on this point.
a. According to the custom of levirate marriage (later codified into law in Deuteronomy 25:5-10), if a man died before providing sons to his wife, it was the duty of his brothers to marry her and to give her sons. The child would be considered the son of the brother who had died, because really the living brother was acting in his place.
i. This was done so the dead brother's name would be carried on; but also, so the widow would have children who could support her. Apart from this, she would likely live the rest of her life as a destitute widow.
b. Onan refused to take this responsibility seriously. He was more than happy to use Tamar for his own sexual gratification, but he did not want to give Tamar a son he would have to support, but would be considered to be the son of Er.
c. Onan pursued sex as only a pleasurable experience. If he really didn't want to father a child by Tamar, why did he have sex with her at all? He refused to fulfill his obligation to his dead brother and Tamar.
d. Many Christians have used this passage as a proof-text against masturbation. Indeed, masturbation has been called "onanism." However, this does not seem to be the case here. Whatever Onan did, he was not masturbating! This was not a sin of masturbation, but a sin of refusing to care for his brother's widow by giving her offspring, and of a selfish use of sex.
Above quote from David Guzik's Commentaries on the Bible courtesy of Studylight.org. Genesis 38 commentary