An infertile person can get married because they have the capacity to perform the procreative act. Despite one person being declared by doctors to be “infertile” that person still can perform the act and still there is always a possibility that despite infertility a person can produce children. Remember Abraham and Sarah? They were infertile but through God’s grace they still were able to produce a child. Even an infertile person by God’s grace can produce a child as long as it is capable to perform the act. The issue here is whether the person/couple can perform the act not whether current medicine considers the person infertile. Basically infertility is not an impediment to procreation as long as the reproductive act happens, there is always a possibility, even if that possibility is low it still exist. Same sex is an impossibility. Two people of the same sex will never be able to perform an act that produces a child. Same se. Will always have a 0 possibility, total impediment. That is not the case with an infertile couple.
Now the second point you have to make on this topic is, (which would be the equal comparison) a man who suffers from impotency cannot be validly married. Impotency is grounds for annulment. The reason why an impotent person cannot be married validly is the same as why homosexual couples can’t. Because they can’t perform the procreative act. It is plain impossible. The act in and of itself cannot be done in any way, neither by an impotent nor by a homosexual couple, hence there is no marriage. Hope that helps.