John Paul II talks about this in his Apostolic Exhortation on Joseph (Redemptoris Custos). Here are the most relevant sections (see below).
The Pope himself says a bit more here: http://www.ewtn.com/library/papaldoc/jp2bvm30.htm
The following extract is helpful, from http://www.catholiccultur...ry/view.cfm?recnum=7535. It suggests that the possibility of the virginal marriage is created by indefinitely extending the period of the Jewish 'kiddushin', in light of the fact that the good of offspring (for which marriage was ordained and sex created) was in this case to be fulfilled by God's direct intervention, in a miraculous way.
St. Ambrose thought it necessary to reaffirm the fact that Mary and Joseph were married. To correct the poor translation of "espoused," he wrote, ". . . for any woman espoused to a man is given the name of wife. It is from the time that a marriage begins that the marital terminology is employed. It is not the deflowering of virginity that makes a marriage, but the marital contract." (St. Ambrose, "The Faith of the Early Fathers," Vol. 2, p.172).
St. Augustine also wrote that Mary and Joseph were truly married in Book 1, "On Marriage And Concupiscence." He writes, "For it was not deceitfully that the angel said to Joseph: 'Fear not to take unto thee Mary thy wife.' She is called his wife because of her first troth of betrothal (kiddushin), although he had no carnal knowledge of her, nor was destined to have."
Centuries later St. Thomas Aquinas, in Summa Theologia1 (New Advent website), writes,
Thus we may say, as to the first perfection, that the marriage of the Virgin Mother of God and Joseph was absolutely true: because both consented to the nuptial bond, but not expressly to the bond of the flesh, save on the condition that it was pleasing to God.For this reason the angel called Mary the wife of Joseph, saying to him (Matthew 1:20): 'Fear not to take unto thee Mary thy wife.'
St Thomas Aquinas also corrected St. Jerome's objections in the Summa Theologiae, "Was There a True Marriage Between Mary And Joseph?"2 St. Jerome assumed that marriage exists only after sexual relations. This was obviously not true of a Jewish marriage, because they are husband and wife after the kiddushin, before they live together. This misconception that a Jewish contractual marriage is the same as a Christian sacramental marriage exists today. You cannot judge "married" by our culture, when considering "married" in another very different culture.
EXTRACTS FROM REDEMPTORIS CUSTOS:
In this marriage none of the requisites of marriage were lacking: "In Christ's parents all the goods of marriage were realized -offspring, fidelity, the sacrament: the offspring being the Lord Jesus himself; fidelity, since there was no adultery: the sacrament, since there was no divorce."(14) ...
According to Jewish custom, marriage took place in two stages: first, the legal, or true marriage was celebrated, and then, only after a certain period of time, the husband brought the wife into his own house. Thus, before he lived with Mary, Joseph was already her "husband." Mary, however, preserved her deep desire to give herself exclusively to God. One may well ask how this desire of Mary's could be reconciled with a "wedding." The answer can only come from the saving events as they unfold, from the special action of God himself. From the moment of the Annunciation, Mary knew that she was to fulfill her virginal desire to give herself exclusively and fully to God precisely by becoming the Mother of God's Son. Becoming a Mother by the power of the Holy Spirit was the form taken by her gift of self: a form which God himself expected of the Virgin Mary, who was "betrothed" to Joseph. Mary uttered her fiat. The fact that Mary was "betrothed" to Joseph was part of the very plan of God. This is pointed out by Luke and especially by Matthew. The words spoken to Joseph are very significant: "Do not fear to take Mary your wife, for that which has been conceived in her is of the Holy Spirit" (Mt 1:20). These words explain the mystery of Joseph's wife: In her motherhood Mary is a virgin. In her, "the Son of the Most High" assumed a human body and became "the Son of Man."
Addressing Joseph through the words of the angel, God speaks to him as the husband of the Virgin of Nazareth. What took place in her through the power of the Holy Spirit also confirmed in a special way the marriage bond which already existed between Joseph and Mary. God's messenger was clear in what he said to Joseph: "Do not fear to take Mary your wife into your home." Hence, what had taken place earlier, namely, Joseph's marriage to Mary, happened in accord with God's will and was meant to endure. In her divine motherhood Mary had to continue to live as "a virgin, the wife of her husband" (cf. Lk 1:27).
19. In the words of the "annunciation" by night, Joseph not only heard the divine truth concerning his wife's indescribable vocation; he also heard once again the truth about his own vocation. This "just" man, who, in the spirit of the noblest traditions of the Chosen People, loved the Virgin of Nazareth and was bound to her by a husband's love, was once again called by God to this love.
"Joseph did as the angel of the Lord commanded him; he took his wife" into his home (Mt 1:24); what was conceived in Mary was "of the Holy Spirit." From expressions such as these are we not to suppose that his love as a man was also given new birth by the Holy Spirit? Are we not to think that the love of God which has been poured forth into the human heart through the Holy Spirit (cf. Rm 5:5) molds every human love to perfection? This love of God also molds-in a completely unique way-the love of husband and wife, deepening within it everything of human worth and beauty, everything that bespeaks an exclusive gift of self, a covenant between persons, and an authentic communion according to the model of the Blessed Trinity.
"Joseph. . .took his wife; but he knew her not, until she had borne a son" (Mt 1:24-25). These words indicate another kind of closeness in marriage. The deep spiritual closeness arising from marital union and the interpersonal contact between man and woman have their definitive origin in the Spirit, the Giver of Life (cf. Jn 6:63). Joseph, in obedience to the Spirit, found in the Spirit the source of love, the conjugal love which he experienced as a man. And this love proved to be greater than this "just man" could ever have expected within the limits of his human heart.
20. In the Liturgy, Mary is celebrated as "united to Joseph, the just man, by a bond of marital and virginal love."(31) There are really two kinds of love here, both of which together represent the mystery of the Church - virgin and spouse - as symbolized in the marriage of Mary and Joseph. "Virginity or celibacy for the sake of the Kingdom of God not only does not contradict the dignity of marriage but presupposes and confirms it. Marriage and virginity are two ways of expressing and living the one mystery of the Covenant of God with his people."(32) the Covenant which is a communion of love between God and human beings.
Through his complete self-sacrifice, Joseph expressed his generous love for the Mother of God, and gave her a husband's "gift of self." Even though he decided to draw back so as not to interfere in the plan of God which was coming to pass in Mary, Joseph obeyed the explicit command of the angel and look Mary into his home, while respecting the fact that she belonged exclusively to God.
On the other hand, it was from his marriage to Mary that Joseph derived his singular dignity and his rights in regard to Jesus. "It is certain that the dignity of the Mother of God is so exalted that nothing could be more sublime; yet because Mary was united to Joseph by the bond of marriage, there can be no doubt but that Joseph approached as no other person ever could that eminent dignity whereby the Mother of God towers above all creatures. Since marriage is the highest degree of association and friendship involving by its very nature a communion of goods, it follows that God, by giving Joseph to the Virgin, did not give him to her only as a companion for life, a witness of her virginity and protector of her honor: he also gave Joseph to Mary in order that he might share, through the marriage pact, in her own sublime greatness."(33)
21. This bond of charity was the core of the Holy Family's life, first in the poverty of Bethlehem, then in their exile in Egypt, and later in the house of Nazareth. The Church deeply venerates this Family, and proposes it as the model of all families. Inserted directly in the mystery of the Incarnation, the Family of Nazareth has its own special mystery. And in this mystery, as in the Incarnation, one finds a true fatherhood: the human form of the family of the Son of God, a true human family, formed by the divine mystery. In this family, Joseph is the father: his fatherhood is not one that derives from begetting offspring; but neither is it an "apparent" or merely "substitute" fatherhood. Rather, it is one that fully shares in authentic human fatherhood and the mission of a father in the family. This is a consequence of the hypostatic union: humanity taken up into the unity of the Divine Person of the Word-Son, Jesus Christ. Together with human nature, all that is human, and especially the family - as the first dimension of man's existence in the world - is also taken up in Christ. Within this context, Joseph's human fatherhood was also "taken up" in the mystery of Christ's Incarnation.
On the basis of this principle, the words which Mary spoke to the twelve-year-old Jesus in the Temple take on their full significance: "Your father and I...have been looking for you." This is no conventional phrase: Mary's words to Jesus show the complete reality of the Incarnation present in the mystery of the Family of Nazareth. From the beginning, Joseph accepted with the "obedience of faith" his human fatherhood over Jesus. And thus, following the light of the Holy Spirit who gives himself to human beings through faith, he certainly came to discover ever more fully the indescribable gift that was his human fatherhood....
26. The total sacrifice, whereby Joseph surrendered his whole existence to the demands of the Messiah's coming into his home, becomes understandable only in the light of his profound interior life. It was from this interior life that "very singular commands and consolations came, bringing him also the logic and strength that belong to simple and clear souls, and giving him the power of making great decisions-such as the decision to put his liberty immediately at the disposition of the divine designs, to make over to them also his legitimate human calling, his conjugal happiness, to accept the conditions, the responsibility and the burden of a family, but, through an incomparable virginal love, to renounce that natural conjugal love that is the foundation and nourishment of the family.(37)