Please explain the Bible's timeline of Jesus' birth and His family's movements following His birth?
The account of Jesus’ movements following His birth is far more complicated than many suppose.
Looking at Matthew’s account we find:
Matt. 2:1 Now after Jesus was born in Bethlehem of Judea in the days of Herod the king, magi from the east arrived in Jerusalem, saying,
Matt. 2:2 “Where is He who has been born King of the Jews? For we saw His star in the east and have come to worship Him.”
Matt. 2:3 When Herod the king heard this, he was troubled, and all Jerusalem with him.
Matt. 2:4 Gathering together all the chief priests and scribes of the people, he inquired of them where the Messiah was to be born.
Matt. 2:5 They said to him, “In Bethlehem of Judea; for this is what has been written by the prophet:
Matt. 2:6 ‘And you, Bethlehem, land of Judah, Are by no means least among the leaders of Judah; For out of you shall come forth a Ruler Who will shepherd My people Israel.’”
Matt. 2:7 Then Herod secretly called the magi and determined from them the exact time the star appeared.
Matt. 2:8 And he sent them to Bethlehem and said, “Go and search carefully for the Child; and when you have found Him, report to me, so that I too may come and worship Him.”
Matt. 2:9 After hearing the king, they went their way; and the star, which they had seen in the east, went on before them until it came and stood over the place where the Child was.
Matt. 2:10 When they saw the star, they rejoiced exceedingly with great joy.
Matt. 2:11 After coming into the house they saw the Child with Mary His mother, and they fell to the ground and worshiped Him. Then, opening their treasures, they presented to Him gifts of gold, frankincense, and myrrh.
Matt. 2:12 And having been warned by God in a dream not to return to Herod, the magi left for their own country by another way.
Matt. 2:13 Now when they had gone, behold, an angel of the Lord appeared to Joseph in a dream and said, “Get up! Take the Child and His mother and flee to Egypt, and remain there until I tell you; for Herod is going to search for the Child to destroy Him.”
Matt. 2:14 So Joseph got up and took the Child and His mother while it was still night, and left for Egypt.
Matt. 2:15 He remained there until the death of Herod. This was to fulfill what had been spoken by the Lord through the prophet: “Out of Egypt I called My Son.”
Matt. 2:16 Then when Herod saw that he had been tricked by the magi, he became very enraged, and sent and slew all the male children who were in Bethlehem and all its vicinity, from two years old and under, according to the time which he had determined from the magi.
Matt. 2:17 Then what had been spoken through Jeremiah the prophet was fulfilled:
Matt. 2:18 “A voice was heard in Ramah, Weeping and great mourning, Rachel weeping for her children; And she refused to be comforted, Because they were no more.”
Matt. 2:19 But when Herod died, behold, an angel of the Lord appeared in a dream to Joseph in Egypt, and said,
Matt. 2:20 “Get up, take the Child and His mother, and go into the land of Israel; for those who sought the Child’s life are dead.”
Matt. 2:21 So Joseph got up, took the Child and His mother, and came into the land of Israel.
Matt. 2:22 But when he heard that Archelaus was reigning over Judea in place of his father Herod, he was afraid to go there. Then after being warned by God in a dream, he left for the regions of Galilee,
Matt. 2:23 and came and lived in a city called Nazareth. This was to fulfill what was spoken through the prophets: “He shall be called a Nazarene.”
In Luke's account we find more:
Luke 2:15 When the angels had gone away from them into heaven, the shepherds began saying to one another, “Let us go straight to Bethlehem then, and see this thing that has happened which the Lord has made known to us.”
Luke 2:16 So they came in a hurry and found their way to Mary and Joseph, and the baby as He lay in the manger.
Luke 2:17 When they had seen this, they made known the statement which had been told them about this Child.
Luke 2:18 And all who heard it wondered at the things which were told them by the shepherds.
Luke 2:19 But Mary treasured all these things, pondering them in her heart.
Luke 2:20 The shepherds went back, glorifying and praising God for all that they had heard and seen, just as had been told them.
Luke 2:21 And when eight days had passed, before His circumcision, His name was then called Jesus, the name given by the angel before He was conceived in the womb.
Luke 2:22 And when the days for their purification according to the law of Moses were completed, they brought Him up to Jerusalem to present Him to the Lord
Luke 2:23 (as it is written in the Law of the Lord, “Every firstborn male that opens the womb shall be called holy to the Lord”),
Luke 2:24 and to offer a sacrifice according to what was said in the Law of the Lord, “A pair of turtledoves or two young pigeons.”
...
Luke 2:39 When they had performed everything according to the Law of the Lord, they returned to Galilee, to their own city of Nazareth.
Based on these two passages and other historical information, we can propose the following chronology of events:
1. Jesus was born in Bethlehem in 6 BC. (Please see our What date did Jesus die? article for details.)
2. After 8 days He was circumcised, and after 40 days Mary and Joseph took Jesus to the Temple in Jerusalem (Luke 2:22).
3. The Magi visited Jesus in Bethlehem (Matt 2:8).
4. The Magi knew the exact date of the appearance of the star, which is the date of Jesus’ birth (v.7). (Please listen to our Wise Men of Babylon teaching for more background.)
5. The star appeared around 2 years earlier, according to v.16, so the events of Matthew 2 occur around 4 BC.
6. Jesus was in Bethlehem at the time of the Magi's visit, which means Joseph and Mary returned to Bethlehem after traveling to Jerusalem and remained there for about 2 years (v.11).
7. Herod attempted to kill Jesus after the Magi visit, so Joseph and Mary took Jesus to Egypt until Herod’s death.
8. Herod dies in 4 BC.
9. After learning of Herod’s death, Joseph, Mary, and Jesus then return to the Galilee after fulfilling all scripture (Luke 2:39).
You may find our Luke Bible Study helpful as well.