Summary: Reviewing Matthew's account of the events surrounding the arrival of the wise men.
“Now after Jesus was born in Bethlehem of Judea in the days of Herod the king, behold, wise men from the east came to Jerusalem, saying, ‘Where is he who has been born king of the Jews? For we saw his star when it rose and have come to worship him.’ When Herod the king heard this, he was troubled, and all Jerusalem with him; and assembling all the chief priests and scribes of the people, he inquired of them where the Christ was to be born. They told him, ‘In Bethlehem of Judea, for so it is written by the prophet:
‘“And you, O Bethlehem, in the land of Judah,
are by no means least among the rulers of Judah;
for from you shall come a ruler
who will shepherd my people Israel.’”
“Then Herod summoned the wise men secretly and ascertained from them what time the star had appeared. And he sent them to Bethlehem, saying, ‘Go and search diligently for the child, and when you have found him, bring me word, that I too may come and worship him.’ After listening to the king, they went on their way. And behold, the star that they had seen when it rose went before them until it came to rest over the place where the child was. When they saw the star, they rejoiced exceedingly with great joy. And going into the house, they saw the child with Mary his mother, and they fell down and worshiped him. Then, opening their treasures, they offered him gifts, gold and frankincense and myrrh. And being warned in a dream not to return to Herod, they departed to their own country by another way.
“Now when they had departed, behold, an angel of the Lord appeared to Joseph in a dream and said, ‘Rise, take the child and his mother, and flee to Egypt, and remain there until I tell you, for Herod is about to search for the child, to destroy him.’ And he rose and took the child and his mother by night and departed to Egypt and remained there until the death of Herod. This was to fulfill what the Lord had spoken by the prophet, ‘Out of Egypt I called my son.’” 
Wise men, perhaps astrologers or members of some other class of mystic sages from Persia, had trekked over vast distances through hostile deserts. This entourage made the long, arduous journey in order to worship a newborn king in Jerusalem, the Judean capital. The unexpected arrival of the caravan undoubtedly created a stir in the Judean capital; and if their arrival created a sensation, the purpose of their coming would explode like an errant bomb in the mind of the ruler of Judea and his court.
These men had witnessed an omen in the heavens—a hitherto unknown star that shone brightly and seemed to guide them toward Jerusalem. They concluded that this omen heralded the birth of a king; they would go to worship this king. Who could have guessed that their presence in the city would cause a wicked ruler to feel threatened by a baby? Who could have known that their arrival would compel the holy family to hurriedly leave their home in order to flee in terror to Egypt?
Isn’t it strange how the revelation of a blessing can bring such sorrow to those who were blessed? Isn’t it strange how so very often we cannot imagine how God can work in the midst of turmoil and grief? And yet, God is at work even when we can’t see Him. We who are followers of the Lamb of God discover, and then we rediscover, that we walk by faith and not by sight. If we could see where God was leading, and if we knew precisely how we fit into God’s plan, we would not be walking by faith. Something like that was happening with Joseph.