The Bible does not mention how Mary traveled to Bethlehem, so her mode of transportation is unknown. What is known is that according to Luke 2:5, she traveled with Joseph to register in the census and was pregnant with Jesus at the time.
While Mary's exact method of transportation is unknown, there are several theories based on what was in use at the time. It would have taken Mary and Joseph 90 miles to travel from Nazareth to Bethlehem. Wealthy families tended to travel using chariots or horses, while poorer families traveled by donkey or on foot. Since Mary and Joseph were not able to find a place to stay in Bethlehem, they were probably a poorer family. Therefore, it is possible that Mary rode a donkey to Bethlehem.