Mary and Joseph lived in Nazareth before Jesus was born. According to the Gospel of Luke, they traveled to Bethlehem when Mary was pregnant with Jesus because of a census that required Joseph's presence in the city.
Mary lived in Nazareth, probably in her parents' house, prior to her engagement with Joseph. During the betrothal period, the angel Gabriel announced to her that she was the chosen one to be the mother of the Messiah. After she became Joseph's wife, she continued to live in Nazareth until they left for Bethlehem. After the birth of Jesus, Mary and Joseph returned to their residence in Nazareth.