The Roman emperor Augustus gave the order to take a census or list to find out how many people were in the Roman Empire. Everybody went to enroll in the city where they were born. As Joseph was of the house and lineage of David, he had with to the Virgin Mary from Nazareth to Bethlehem.
The trip had to do with a donkey and the virgin mounted in it because she was pregnant and it would be difficult to walk.