Yes, of course Mary and Joseph were truly married. There is a lot of confusion about this and you sometimes hear the false claim that Mary was an "unwed mother." Bah! This is nonsense.
The misunderstanding derives from the orthodox teaching that Mary and Joseph did not have relations even though they were married.
The reason for their virginal union has been apparent to Christians for 2,000 years: Mary's stainless womb is the Ark of the New Covenant and it is the Gate of Heaven. Her soul, but also her body was united to God in an intimate way. So then, in the Old Testament, men were killed for simply touching the ark of the covenant on account of its holiness. How much more holy, then, was the shrine of the Incarnate Lord Jesus Christ who dwelt there for nine full months. People and things that are used for holy purposes and are not suitable for natural purposes.
Restaurants are good things. But this doesn't mean that it's okay use your church for a restaurant and use the altar as a serving table. Similarly, the holy sacrament of marriage is good and so is the procreation of children. Yet Mary's condition and office as the Mother of the Son of God sets her apart so that she and Joseph would not and did not enjoy the natural good of conjugal relations.
In conclusion to this point: A married couple having right relations is both good and meritorious, but when the wife happens to be mother of the Son of God, then, the rules of propriety change.
So then, some well-meaning Catholics are confused as to whether Joseph and Mary were truly and really married (as opposed to being only "betrothed"), since they did not sexually consummate their union. For example, Saint Jerome once wrote: "Joseph was more her guardian than her husband." This is true, of course, but it doesn't negate that Joseph was still her true husband.
Saint Thomas Aquinas explains that: "the end of matrimony is the begetting and upbringing of children: the first of which is attained by conjugal intercourse; the second by the other duties of husband and wife, by which they help one another in rearing their offspring."
Joseph and Mary, then, did not consummate their marriage in the former way, but in the latter way. Their marriage was without intercourse, but it was not without childbearing. Hence, their marriage conformed to the purpose of marriage in a miraculous way - by the Incarnation of Christ in the womb of Mary. Marriage is always ordained unto the procreation of children and the propagation of the human race. Observe the wisdom of God in establishing the marriage of Joseph and Mary. Even the miracle of the Incarnation did not set aside the natural institution of matrimony. Grace does not destroy nature, but perfects it.
For more details, see Saint Thomas Aquinas, Summa theologiae III, q. 29, a. 2.
Holy Mary, Ark of the Covenant, pray for us.
Saint Joseph, Guardian of the Redeemer, pray for us.
I recommend these two books on Mary and Joseph: