I'm guessing because Joseph thought she was pregnant by another man. The angel asked Mary first before her being impregnated. It is logical that he would have asked Joseph the same, and not just take it without permission.
Still there had to be something of David's bloodline in Jesus, so I never came up with a satisfactory explanation. Somewhere I read the term parthenogenisis, self-impregnation by some type of cell division, not that I'm buying that either.
In any case, the embryo had to be without the stain of sin, so there had to be some gene cleansing process somehow.
Both Mary and Joseph were in the bloodline of David. Since Joseph was not the physical father, to fulfill the prophecy that the Messiah would be from the line of David, Mary was along that line too. Joseph and Mary were not close relatives so their marriage was not forbidden.