Joseph went there to register with Mary. She had been promised to him in marriage and was pregnant.
At that time the Emperor Augustus ordered a census of the Roman Empire.
All the people went to register in the cities where their ancestors had lived.
So Joseph went from Nazareth, a city in Galilee, to a Judean city called Bethlehem. Joseph, a descendant of King David, went to Bethlehem because David had been born there.
While they were in Bethlehem, the time came for Mary to have her child.