Joseph the Carpenter is the husband of the virgin Mary who acted as guardian of Jesus Christ. 

When Joseph discovered that his fiancé Mary was pregnant, he tried to determine how to handle the situation.  Matthew 1:18-25 recorded Joseph’s dilemma and its resolution.

Now the birth of Jesus Christ was on this wise: When as his mother Mary was espoused to Joseph, before they came together, she was found with child of the Holy Ghost.
Then Joseph her husband, being a just man, and not willing to make her a publick example, was minded to put her away privily.
But while he thought on these things, behold, the angel of the Lord appeared unto him in a dream, saying, Joseph, thou son of David, fear not to take unto thee Mary thy wife: for that which is conceived in her is of the Holy Ghost.
And she shall bring forth a son, and thou shalt call his name JESUS for he shall save his people from their sins.
Now all this was done, that it might be fulfilled which was spoken of the Lord by the prophet, saying,
Behold, a virgin shall be with child, and shall bring forth a son, and they shall call his name Emmanuel, which being interpreted is, God with us.
Then Joseph being raised from sleep did as the angel of the Lord had bidden him, and took unto him his wife
And knew her not till she had brought forth her firstborn son: and he called his name JESUS

Travelling to Bethlehem to be Taxed

Near the end of Mary’s pregnancy, Joseph and Mary travelled to Bethlehem to obey the law.

And all went to be taxed, every one into his own city.
And Joseph also went up from Galilee, out of the city of Nazareth, into Judæa, unto the city of David, which is called Bethlehem; because he was of the house and lineage of David:)
To be taxed with Mary his espoused wife, being great with child (Luke 2:3-5).

Mary gave birth to Jesus at Bethlehem. 

An Angel Commands Joseph to Flee and Return

Joseph, Mary, and Jesus stayed in Bethlehem until wisemen worshipped Jesus.  They came from the East and followed a star to meet Jesus. 

Matthew 2:13-23 recorded the dangerous situation for Joseph’s family when the wisemen left Bethlehem.

And when they were departed, behold, the angel of the Lord appeareth to Joseph in a dream, saying, Arise, and take the young child and his mother, and flee into Egypt, and be thou there until I bring thee word: for Herod will seek the young child to destroy him.
When he arose, he took the young child and his mother by night, and departed into Egypt:
And was there until the death of Herod: that it might be fulfilled which was spoken of the Lord by the prophet, saying, Out of Egypt have I called my son.
Then Herod, when he saw that he was mocked of the wise men, was exceeding wroth, and sent forth, and slew all the children that were in Bethlehem, and in all the coasts thereof, from two years old and under, according to the time which he had diligently inquired of the wise men.
Then was fulfilled that which was spoken by Jeremy the prophet, saying,
In Rama was there a voice heard, lamentation, and weeping, and great mourning, Rachel weeping for her children, and would not be comforted, because they are not.
But when Herod was dead, behold, an angel of the Lord appeareth in a dream to Joseph in Egypt,
Saying, Arise, and take the young child and his mother, and go into the land of Israel: for they are dead which sought the young child’s life.
And he arose, and took the young child and his mother, and came into the land of Israel.
But when he heard that Archelaus did reign in Judæa in the room of his father Herod, he was afraid to go thither: notwithstanding, being warned of God in a dream, he turned aside into the parts of Galilee:
And he came and dwelt in a city called Nazareth: that it might be fulfilled which was spoken by the prophets, He shall be called a Nazarene.

Losing Jesus in Jerusalem

When Jesus was 12 years old, the family went to Jerusalem for the Passover.  When the rest of the family began the trip home, Jesus remained in Jerusalem.  Mary and Joseph searched three days for Jesus. They found Jesus teaching in the temple. 

And when they saw him, they were amazed: and his mother said unto him, Son, why hast thou thus dealt with us? behold, thy father and I have sought thee sorrowing.

And he said unto them, How is it that ye sought me? wist ye not that I must be about my Father’s business?

And they understood not the saying which he spake unto them.

And he went down with them, and came to Nazareth, and was subject unto them: but his mother kept all these sayings in her heart (Luke 2:48-51).

That story is the last mention of Joseph in the New Testament.  

Though Joseph was not Jesus’ father, he protected and guided Jesus as his own son. That angels ministered to and directed Joseph evidenced his righteousness and important work in caring for the Son of God. 

Something to Consider:

Joseph and Mary’s genealogies are given in Matthew 1 and Luke 3.  Mary is possibly Joseph’s cousin through Joseph’s uncle Jacob.

Since Jesus committed Mary to John’s care from the cross at Calvary, Joseph most likely died before the crucifixion.