Because God was the Father.
If Joseph was Jesus’ father, then Jesus would have been just a man. On the other hand, without a human mother, Jesus would have been ‘just’ God. But by having a Divine Father and a human mother, He was both completely man and completely God. On the other hand, if Mary wasn’t a virgin, then that would, in a certain sense, make Mary and adulteress. That’s no good either.
Also, we have to realize that chastity is an objectively higher calling than marriage and procreation. Even St. Paul tells us that if we can get ourselves to remain chaste, to do it, but that if we can’t handle it, to marry instead. When one is chaste, they can devote themselves more completely to God. When one is married, they must also devote themselves to their spouse and family. Christ wanted the best for His mother, one who was able to be most completely devoted to God.