Why does Matthew record the genealogy of Joseph in his introduction to the Savior’s mortal mission? Would not Mary’s genealogy be more important? Were Joseph and Mary so closely related that their genealogies were nearly the same? Thank you for entertaining these questions.
The Book of Matthew was written specifically to the Jews. Thus, one of the goals of this Gospel was to convince the Jews of the Messiahship of Jesus. One of the prophecies stated that He would be the rightful heir to the throne of David (Jeremiah 23:5, Jeremiah 33:17). And that line of inheritance was actually traced through Joseph, his adoptive father. That means that if Rome wasn’t in charge at the time, and the Kingdom of Israel still had its own king to rule over them, that king would have been Joseph.
But he wasn’t Jesus actual father! It is true that he was not the Savior’s biological father. The social order of the time made adoption simply a matter of verba solemnia (solemn verbal declaration/agreement):
You are my son.
You are my father.
Then they would have to actually “walk the walk” which they seem to have done, based on what we read in the Gospel of John.
And they said, Is not this Jesus, the son of Joseph, whose father and mother we know? How is it then that he saith, I came down from heaven? (John 6:42)
So, apparently, they went through the process and behaved in a manner that everyone believed Jesus to be Joseph’s son. This legal adoption gave Jesus all the legal rights of inheritance through his adoptive father. And there was a reason the Messiah HAD to be adopted.
The legal heir had to come from the line of David. But the rightful line also went through Coniah (also known as: Jeconiah, Jechonias, & Jehoiachin) who ruled in exile after Nebuchadnezzar killed his father, Jehoiakim. (It was only after Coniah’s exile that Zedekiah began to rule at the time Lehi and his family left Jerusalem). He (Coniah) so displeased the Lord that the Lord cursed his seed from ever ruling over Judah on the throne of David.
Thus saith the LORD, Write ye this man childless, a man that shall not prosper in his days: for no man of his seed shall prosper, sitting upon the throne of David, and ruling any more in Judah. (Jeremiah 22:30)
Since the royal line descended from Coniah, and Coniah’s seed was cursed to never sit upon the throne of David or rule in Judah, then how could the Messiah fulfill the prophecy without invalidating God’s curse? Adoption fulfilled both the Messianic prophecy (coming through David’s line) as well as upheld the curse upon Coniah’s seed.
Now, to your second question about the familial relationship between Joseph and Mary, they were distant cousins. The lineage depicted in Luke 3 is usually believed to be Mary’s line. And in verse 31 we read:
Which was the son of Melea, which was the son of Menan, which was the son of Mattatha, which was the son of Nathan, which was the son of David (Luke 3:31)
So, Mary’s line came through Solomon’s brother, Nathan. That was 27 generations back. So, that was a pretty distant cousin. There are also some indications that the two lines of cousins crisscrossed in the intervening generations because some names seem similar, even though they are spelled differently. But I personally believe that interpretation to be somewhat tenuous.
Whatever their precise relationship, they both appeared to be of royal blood.