Q. Mary is described as a virgin in the Bible and in the Quran. However, her husband is never mentioned in the Quran. Was she married to Joseph but never had sexual relations with him, keeping her virginity?
With all due respect and no offense intended to my Catholic and Orthodox brothers and sisters in the faith and others who would also see this differently, my understanding from the Bible is that Mary and Joseph had the usual kind of marriage in which they had sexual relations and in fact had several children together, but only after Jesus was born.
Matthew tells us in his gospel that after Mary conceived Jesus as a virgin, an angel appeared in a dream to Joseph and explained to him what had happened. Matthew then relates, “When Joseph woke up, he did as the Lord’s angel had commanded him. He married Mary, but he did not have sexual relations with her until she had given birth to a son.” In other words, once Mary had given birth to a son, Jesus, then Joseph and she did have sexual relations, as husbands and wives ordinarily do.
Matthew tells us further that when, during the course of his ministry, Jesus returned to his home town of Nazareth, the people there asked, “Where did this man get this wisdom and these mighty works? Is not this the carpenter’s son? Is not his mother called Mary? And are not his brothers James and Joseph and Simon and Judas? And are not all his sisters with us?” So it would appear that Joseph and Mary had at least seven children together after Jesus was born, the four named sons and apparently at least three daughters, based on the expression “all his sisters.” (If there had been only one daughter, the people would have said “his sister,” and if there had been only two, they would have said “both of his sisters.”)
So I understand from these passages that while Mary conceived Jesus as a virgin and she remained a virgin until he was born, even though she married Joseph before that, once Jesus had been born, Joseph and Mary raised a family together as husband and wife. To me, that takes nothing away from the special role that Mary played as the mother of Jesus and that Joseph played as his legal father though not his biological father. Rather, I see this as God affirming marriage and child-rearing as beautiful elements of his intentions for human thriving.
Matthew 13 and Luke 4, both speak of Joseph in the present tense, when Jesus started his ministry, so he must have died after that time.