There is no better answer to this question than by quoting from the actual scripture taken from Luke Ch. 1 v 1-5.
1 AND it came to pass in those days, that there went out a decree from Cæsar Augustus, that all the world should be taxed.
2 (And this taxing was first made when Cyrenius was governor of Syria.)
3 And all went to be taxed, every one into his own city.
4 And Joseph also went up from Galilee, out of the city of Nazareth, into Judæa, unto the city of David, which is called Bethlehem; (because he was of the house and lineage of David:)
5 To be taxed with Mary his espoused wife, being great with child.
You may have been expecting some elaborate write regarding your question, my suggestion is to go direct to the source
Mary and Joseph were required to be there to participate in a census.
to have a baby
"So Joseph also went up from the town of Nazareth in Galilee to Judea, to Bethlehem the town of David, because he belonged to the house and line of David."
The census was ordered by the Roman governor Quirinius, probably as a basis for taxation. In any case everyone had to return to their birthplace--and Bethlehem was Joseph's birthplace. And this happened about the time Jesus was to be born. By some accounts, the family later left as a result of the interest of King Herod of Judea in finding the King of the Jews.
We do not know what was in Joseph or Mary's mind that led them to Bethlehem before Jesus was born. perhaps there was a compelling reason for them to go there at that particular time. We do know that God played a very large part in why they went to Bethlehem because it had been prophesied before hand that the Messiah would come out of Bethlehem and that prophecy had to be fulfilled (See Micah 5:2).
All we know is that in the mind of Joseph and Mary was that they had to go to Bethlehem at that particular time.
We have seen in Scripture more than once that God has directed persons to do certain things and unbeknown to them they were fulfilling a purpose for God.
Fleeing persecution, mainly to protect the new born.
Joseph and Mary were both of the family of David and were in Bethlehem to be counted in a census.
As they had to go to Bethlehem for the census.
According to the Bibilical story, it was Joseph's home town, and he had to go to his home town to register for the census under the law at the time.
False
Jewish
The Lord Jesus Christ was born in Bethlehem near Jerusalem, not Iraq. He was discovered with his parents Joseph and Mary. They had wrapped him in swaddling clothes and lay him in a manger
Jesus was born in Bethlehem in a stable! >_<
Jesus was born in Bethlehem, David was from Bethlehem
Jesus' father, Joseph was from Bethlehem in Judea and Jesus was from there. His Mother, Mary was from Nazareth in Galilee. Both lands were Jewish.
O Little Town of BETHLEHEM was where Jesus was born. Bethlehem in Israel.
Jesus left Bethlehem to escape to Egypt
Bethlehem
The baby Jesus was born in Bethlehem.
The prominent baby born during the rule of Augustus in Bethlehem was Jesus of Nazareth.The prominent baby born during the rule of Augustus in Bethlehem was Jesus of Nazareth.The prominent baby born during the rule of Augustus in Bethlehem was Jesus of Nazareth.The prominent baby born during the rule of Augustus in Bethlehem was Jesus of Nazareth.The prominent baby born during the rule of Augustus in Bethlehem was Jesus of Nazareth.The prominent baby born during the rule of Augustus in Bethlehem was Jesus of Nazareth.The prominent baby born during the rule of Augustus in Bethlehem was Jesus of Nazareth.The prominent baby born during the rule of Augustus in Bethlehem was Jesus of Nazareth.The prominent baby born during the rule of Augustus in Bethlehem was Jesus of Nazareth.
Jesus was born in Bethlehem. His parents took him to Egypt for a couple years because of Herod. Then they went to Palestine (now Israel) where he spent his life.