Pope John Paul II: "I declare that direct abortion, that is, abortion willed as an end or as a means, always constitutes a grave moral disorder, since it is the deliberate killing of an innocent human being." (Evangelium Vitae, n. 62).
Direct abortion is always immoral. Indirect abortion is sometimes moral. An abortion is "indirect" when the deliberately willed act (the knowingly chosen act) is, by its very nature, ordered only toward the health and life of the mother, and not also ordered toward killing the prenatal. If a woman has cancer, and the prenatal's life cannot be saved, then a cancer treatment may be used, even though it indirectly kills the prenatal. Such an abortion is indirect.
But direct abortion, even with the sole intention of saving the life of the mother, is always immoral. The end does not justify the means. No intention, however good, and no circumstance, however dire, can justify an intrinsically evil act.
The same distinction can be applied to contraception. Direct contraception is the deliberate and knowing choice of any act (barrier methods, pills, withdrawal, etc.) that is ordered toward depriving the sexual act of its procreative meaning, regardless of whether the contraceptive is used as an end (with the intention to contracept) or as a means to another intended end (such as preventing disease transmission).
However, the use of a contraceptive in cases of rape is indirect, in my opinion, and therefore moral. The natural sexual act is inherently ordered toward conception; that is why contraception is immoral. But this also implies that, when a rape occurs, the prevention of conception is morally an interruption of the rape.
As an example, suppose that a rape is occurring in an alley, and a passerby happens upon the crime and shouts or otherwise intervenes. He interrupts the rape, and so conception is prevented. But his act is not a type of contraception, but only an interruption of the rape. Morally, the use of contraception (but not abortifacients) is indirect for much the same reason.
However, this does not imply that married or unmarried couples may use contraception with a good intention, or in a dire circumstance. The use of contraception, in marriage or out of marriage, is almost always direct, and therefore intrinsically evil and always gravely immoral.