It has always been a part of the Church’s teaching that procreation and the rearing of children is the primary end of sex, the unitive aspect being a secondary end inasmuch as it presupposes the procreative. But this doesn’t entail that the couple must always intend the primary end, as long as they do not frustrate nature’s purposes.
The Church teaches that the sexual act itself must always have its intrinsic ordering toward the generation of children. What this means is that the couple can never do anything to intentionally thwart the procreative end of sex, since procreation is what sex is for. To do so would be to violate human nature, and thus to violate God’s will. Pope Paul VI says:
The Church, nevertheless, in urging men to the observance of the precepts of the natural law, which it interprets by its constant doctrine, teaches that each and every marital act must of necessity retain its intrinsic relationship to the procreation of human life (Humanae Vitae 11; emphasis added).
If a couple has just reasons for not having children at a particular time, and they desire to express their love through sexual intercourse, they may do so during the woman’s infertile periods. This is called natural family planning (NFP).
NFP is not contrary to nature because it in no way frustrates nature’s design for sex. It is nature’s doing that the woman doesn’t conceive during this time period. And since sexual intercourse during infertile periods is in agreement with nature’s design for sex, it is in agreement with God’s will, for God’s will is expressed in the order of nature. Pope Pius XI taught as much in 1930 in Casti Connubi (59).
So, although a couple doesn’t have to intend to have a child in every act of sexual intercourse, they may never actively impede the sexual act from being ordered toward producing a child.