This passage creates more questions than it seems to answer. Herod, like so many prideful and paranoid kings, thinks he can overcome the prophecies of God by eliminating the future King. This continues and results in the death of all boys in the area of Bethlehem under 2 years of age. We can see God’s protection and guidance throughout this period. After Herod’s death, they return to Nazareth.
1 Kings 18:1-19