Joseph was told not to divorce Mary, as that was what he was thinking of doing.
no, an angel
The angel Gabriel appeared to Joseph in a dream to tell him about Mary's pregnancy.
We know nothing at all about either Mary or Joseph other than what we read in the Bible. This does not even tell us whether Mary outlived Joseph, nor whether she remarried if he did die first.
According to the gospel of Luke, Mary was told about her pregnancy by an angel.
There IS no place in the Bible where an innkeeper speaks to Joseph and Mary about anything. The only thing the Bible says is that they stayed in the stable because there was no place for them in the lodging room.(Luke 2:6-7)
AnswerIn Luke's Gospel, Mary and Joseph travelled from Nazareth to Bethlehem for a census. When they found no room in the inn, they stayed in a stable, where Jesus was born (Luke 2:7). In Matthew's Gospel, this was not necessary because Bethlehem was already the home town of Mary and Joseph, and they had a house (Matthew 2:11).
In those ages the records are not kept correctly like today. And as people were mot so educated as well either. So in the bible the age of Mary and the age of Joseph are not at all mentioned clearly at all.
Joseph was told that his fiancee was going to get pregnant with the power of the holy spirit. and to name him Jesus and that he would be the savior of the world.
According some sources, Joseph had yet died. Mary continued to worship and participate in the first kehilah (congregation) with her sons Jacob, Jude, Joseph and Shimon, as its written in Acts.
In Matthew's Gospel, Joseph, Mary and Jesus were returning to their family home in Bethlehem after the death of Herod, when God appeared to Joseph in a dream and told them to turn aside and go to Galilee, where they settled in Nazareth.
The Angel said that the Child is from God and Joseph was not to divorce Mary for supposed infidelity. In another dream, the Angel told Joseph to take Mary and Jesus to Egypt to avoid King Herod's order to kill all boys under age 2.