At that time the Roman emperor, Augustus, decreed that a census should be taken throughout the Roman Empire. (This was the first census taken when Quirinius was governor of Syria.) All returned to their own ancestral towns to register for this census. And because Joseph was a descendant of King David, he had to go to Bethlehem in Judea, David’s ancient home. He traveled there from the village of Nazareth in Galilee. He took with him Mary, his fiancée, who was now obviously pregnant. Luke 2:1-4 NLT
Later the pharisees tried to discredit Jesus’ ministry by saying,
“Are you from Galilee, too? Search the Scriptures and see for yourself—no prophet ever comes from Galilee!” John 7:52 NLT
They were correct, the Messiah comes from Bethlehem, not Galilee.
But you, O Bethlehem Ephrathah, are only a small village among all the people of Judah.Yet a ruler of Israel will come from you, one whose origins are from the distant past. Micah 5:2 NLT
Of course we know that Jesus was indeed born in Bethlehem and not Galilee, just like the Bible says the Messiah would be. Here we see how accurate the Bible is.
Mary, being pregnant, probably did not enjoy the journey to Bethlehem. I am sure she and Joseph also did not enjoy having to travel for the sake of a census. It may have all sounded foolish to them, however, it got them to exactly where they needed to be so that the Scriptures could be fulfilled and demonstrate Jesus to be Messiah.
Life may throw you some curves, and possibly send you on some apparent detours, but it is all really a part of God’s plan to get you to exactly where you need to be.