According to the New Testament, Syrian Governor Quirinius called the Census, see Luke 2:1-7 below. Secular Historians note that Quirinius only called a census in 5 C.E., which would have been too late to be relevant for Jesus' birth.
Luke 2:1–7: In those days a decree went out from Emperor Augustus that all the world should be registered. This was the first registration and was taken while Quirinius was governor of Syria. All went to their own towns to be registered. Joseph also went from the town of Nazareth in Galilee to Judea, to the city of David called Bethlehem, because he was descended from the house and family of David. He went to be registered with Mary, to whom he was engaged and who was expecting a child.
a census
No. They went because Casear ordered a CENSUS of all the people. A CENSUS is when the people are counted. Men had to take their wives and children, if they had them, to the city of their birth.
Joseph and Mary traveled to Bethlehem , as it was told to go to their respective hometowns for the census.
Joseph and Mary went to Bethlehem to be counted in a census so they could be taxed.
Mary and Joseph were obliged to go to Bethlehem for the census by the Roman authorities. In a sense you could also say God led them, since it was ordained that Christ would be born in Bethlehem.
Mary and Joseph went to Bethlehem to register because Joseph traced his lineage back to people from that city.
Are you referring to the census that luke mentions as the reason for why Mary and Joseph travel to Bethlehem? We have no historical record of such a census.
because there was a census that was being done and every man had to go to their own hometown.
We do not know anything about Joseph or where he was born, but we can make an educated guess. People tended to live in the town in which they were born. In Matthew's Gospel, Bethlehem seems to be the home town of Mary and Joseph, so Joseph was probably born in Bethlehem. In Luke's Gospel, Nazareth was the home town of Mary and Joseph, so Joseph was probably born in Nazareth.
Mary and Joseph had to travel to Bethlehem, Joseph's ancestral home, to be counted in the census ordered by the Roman Emperor. This journey was approximately 90 miles and they likely traveled by foot or on a donkey.
Luke 2:1-7 tells the story of the Birth of Christ in Bethlehem. Bethlehem was known as the City of David because it was the hometown of King David, Joseph's ancestor. Because Caesar Augustus had demanded a census, all men had to take their families to register in their ancestral cities (this was simply how they organized the information). While they were registering in the census at Bethlehem, Jesus was born in the city of his ancestor David, whose reign as king Jesus would fulfill.
Yes, there was a mandatory census so they could be counted. They traveled a long way, too!