The flight into Egypt is a story recounted in the Gospel of Matthew (Matthew 2:13–23) and in New Testament apocrypha. Soon after the visit by the Magi, an angel appeared to Joseph in a dream telling him to flee to Egypt with Mary and the infant Jesus since King Herod would seek the child to kill him.
The Christ child had to go to Egypt, and come out of Egypt, to fulfill prophecy. Unfortunately, the murder of the small boys in Bethlehem was prophesied as well.
Also, while Egypt and Judea were separate countries, they were both part of the Roman Empire so really it was like Joseph, Mary, and Jesus fled New Mexico and escaped into Texas.
In other words, are you really a refugee if you leave one part of the Roman Empire only to find refuge in another part of the Roman Empire?
They weren’t refugees, they were on the lam.