The first reading describes the prophecy of Jeremiah about a future "son of David" who will reign successfully in contrast to the kings of the past. The future ideal king is described as "a righteous shoot (descendent) of David who, unlike his predecessors, will reign and govern wisely. He will be the Saviour of Judah and will be called "the Lord-our integrity."
The prophecy of Jeremiah fueled the messianic hopes of Israel in the centuries that followed and was fulfilled with the coming of Jesus, the Son of David, five centuries later. The coming of the ideal king in the Person of Jesus was an extraordinary event.
The Gospel passage narrates the events leading to Joseph's decision on whether to take Mary into his house as his wife. On discovering Mary's pregnancy, he wondered if it would be kinder for him to divorce her quietly and, in doing so, terminate any legal obligation of marriage on both sides.
However, divine intervention with the appearance of an angel in a dream helps make up his mind. The angel's message is that Joseph, "the son of David," is to take Mary into his house.
This is not so much to protect her as to confer Davidic paternity on her child as the Son of David and as the legal son of Joseph. Therefore, Joseph's key role is to act as the child's father by giving Him the name God had already chosen, "Jesus", which is related to the Hebrew verb for "save".
Jesus, Son of David, You are our Saviour.