“Love the Lord with all your heart, and with all your soul,
and with all your MIND”--Matt 22:37
The question is a valid one, I think, often posed by proponents of same sex "marriage" (SSM). Their reasoning is correct: if the Church says that SSM is wrong because it cannot produce children, then why does the Church permit men and women who are past the age of childbearing (or who may have had hysterectomies) to marry?**
The answer is that the argument the Church presents against SSM is not that it is immoral because it can't produce children. SSM is immoral because it is not ordered to the procreation of children. The Code of Canon Law states that "marriage is a permanent partnership between a man and a woman ordered to the procreation of offspring by means of some sexual cooperation" (CIC 1096)
What does "ordered to" mean? It means that all actions that are done must be done with the end result in mind. So eating must be ordered towards providing nutrition to the body. Thus, when a person eats, and then attempts to vomit the contents of her meal, this is called an eating dis-order, because the behavior is contrary to the purpose, or proper end, of eating: providing nutrients to the body.
For an act to be moral, it must be ordered to its proper end.
So the "marital embrace" must be ordered to its proper end: procreation. Sexual acts between 2 males or 2 females can never be ordered towards the procreation of offspring. Sexual acts between, say, an elderly man and woman are still ordered towards procreation, even if their actions will never ever produce a single child.
How does this work?
Take this analogy borrowed from the wickedly funny yet orthodox and insightful Catholic blogger, Marc Barnes at http://www.patheos.com/blogs/badcatholic/
Imagine a senior citizens baseball team that shows up to play the St. Louis Cardinals. They have absolutely no chance of achieving the proper end of baseball (gaining more runs than the other team), but so long as they play according to the rules, their play is still ordered to its proper end.
But in the case of SSM, the play itself is changed. It would be like 2 teams showing up at the game without bats, wanting to play with their backs to each other so that even if they have the "intent" of winning a baseball game, what they are doing can't possibly be ordered to that end because they are, quite simply, no longer playing baseball.
So some married couples (the elderly, post-menopausal women, women post-hysterectomy, etc etc etc) may have sexual relations that are infertile, but their acts will always still be ordered towards life. While they have zero chance of conceiving, their marital embrace is still ordered towards the proper end of marriage: procreation and union.
**(Note: impotency is indeed an impediment to marriage and the Church does not allow a couple to marry if they cannot complete the marital act. But that is a topic for another discussion.)