I know that married couples cannot use condoms to prevent pregnancy, but what if either member in the relationship is infertile and the condom was used strictly to restrict the spread of STDs? In this case there is not even an act of contraception, because it is already God’s will that there would be no life. So if there was somebody who was not capable of giving birth, would it still be a sin to use a condom?
The marital act is not solely intended for the procreation of children. It is also intended for the unity of the couple, and contraception hinders that unity by the various “barriers” it employs to frustrate the full union of the couple. And even an infertile couple must leave their relations open to the possibility of new life, unlikely though new life may be. Just because one of the partners is diagnosed as infertile does not mean that it is “God’s will” that there be no new life. Rachel, Hannah, and Elizabeth are all examples of women in Scripture who were believed infertile and yet conceived children.
As for the prevention of STDs, there has been some discussion among moral theologians about the possibilities for licit means of preventing the transmission of STDs in married couples. The ordinary teaching of the Church though is that couples who are not able to safely engage in marital relations should entirely abstain from engaging in them.