There are three conditions for mortal sin: that the act is grave matter, done with full knowledge and deliberate consent. “Mortal sin…presupposes knowledge of the sinful character of the act, of its opposition to God’s law” (CCC 1859).
In practice there are a couple factors at play here. One can be vincibly (ie. culpably) ignorant, meaning that he does not know that a given act is sinful but ought to know, and he is responsible for not knowing.
I don’t think that to have knowledge of an act, one must a). know that it is a sin qua against God, ie. to know that God exists and disapproves of the act and b). agree that it is wrong. Those are rather strong conditions for an act to be mortally sinful, and indeed they would exclude any non-Christian from mortally sinning; one simply would have to believe strongly enough that what one is doing is not sinful.
However, whether a person contraceiving or cohabiting is guilty of mortal sin is not something that we can say in the concrete case, since we do not know the person’s subjective disposition (and thereby we do not know their subjective culpability). This is why the Church has saints, ie. those pronounced definitively to be in heaven, but the Church does not rule that a particular person has gone to hell. We simply don’t know. We know that contraceiving and cohabiting are objectively sinful, ie. they are grave matter, and it is better that those taking part in them be admonished, but in the particular case, we cannot judge* that someone has mortally sinned.
There are natural truths that human beings should know whether they are Christian or not. Someone could not defend his committing of murder by saying that he was not taught the Fifth Commandment. In the cases of contraceiving and cohabiting, the subjective culpability is grayer. What about someone who was raised in a public school system and was told that contraception is moral? Or a child who watches his parents pirate movies, and goes on to do it himself? These are instances of scandal which damage someone’s moral sense while they are still developing it. We shouldn’t assume that we know how culpable they are. (This is not to say that someone is not at all culpable in these cases.)
*The disconnect between Christian and secular understanding of the word “judge” is at work here. We should not judge, ie. presume to make a determination based on someone’s subjective culpability. But we absolutely should speak up when someone is committing an objectively sinful act. Whether they are mortally culpable for the act or not, the objectively sinful act should not be performed.
A clarification: This question does not turn on the totally different question of whether homosexuals are “born that way” or that they are “damaged” (by society, perhaps). To me it seems pretty obvious that same-sex attraction arises from genetic and environmental factors. And that basically means that those with same-sex attraction did not choose it. (To acquire certain desires through environmental factors early in your life is not to choose to have those desires.) The question of whether same-sex attraction is “chosen” is a total red herring.
But to have desires is not necessarily to license one to exercise those desires. An alcoholic wants to drink, but he still ought not to drink. (And this is not to compare those with same-sex attraction with alcoholics, just to prove the claim that to have a desire is not to have a license to exercise that desire.) The exercise of a desire is quite independent, morally speaking, of the possession of the desire. (That is obvious from the fact that if it is moral for those with same-sex attraction to practice homosexuality, then it is also moral for those without same-sex attraction to practice homosexuality. Desire is irrelevant. Unless someone wants to claim that someone without the desire is not permitted to act on it, while someone with the desire is. But I doubt anyone will make that argument.) If the exercise of the desire is morally wrong (which is what the issue actually is), then it should not be exercised.
Living out the desire would be acceptable only if one were truly compelled to do so, ie. if we did not have the free will to do otherwise. But that is not the case.