The contraceptive effect is secondary.
You’re making a ‘double effect’ argument, then. OK; let’s see if that holds up…
I suggest the use of a condom not to prevent pregnancy, but rather to prevent disease. It is complete stupidity to have sex - particularly without a condom - with someone who has probably had hundreds of sex partners. The contraceptive effect is secondary.
So, the desired positive effect is ‘disease prevention’. The unintended (but foreseeable) negative effect is ‘contraception’. (In particular, it is contraception by means of a barrier method, in this case.)
So… does the positive effect proceed from the negative effect? That is, is this an argument of ‘the ends justify the means’? In this case, yes, that’s exactly what’s happening here: the condom thwarts the spread of disease by preventing the transmission of bodily fluids.
Therefore, since the positive effect happens by means of the operation of the negative effect, there is no valid double effect argument that can be made in this case. In other words, the contraceptive effect is not
secondary; it is the means through which disease prevention occurs. One can not participate in an immoral action, in order to achieve a desired goal, no matter how good that goal is.
(There’s a good case to be made in the example of the male prostitute; however, in a discussion of an encounter between a man and a woman – client and prostitute (regardless which is which

) – the fact of contraception
is relevant and
is grave matter.)