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.