This prophecy has a double application (to both Israel and Christ). For Christ, it should be taken in its plain literal sense. God foreknew and foresaw the slaughter of the innocents by Herod, and how necessary it would be for Joseph, Mary, and Jesus to escape to Egypt until this Herod was dead. Even Herod's evil deeds against the children in Bethlehem were prophesied, and that there would be great lamentation and weeping in Ramah.What do you believe is the meaning of this prophesy as it relates to Jesus.
So this prophecy of calling Christ out of Egypt signifies that He would remain in Egypt temporarily, and then God would reveal to His "parents" when it was time to come out of Egypt and go back to Nazareth, since Christ would be called "a Nazarene".
We should also keep in mind that Egypt became a temporary refuge for the children of Israel until the time that a wicked Pharaoh would begin oppressing them. Then Moses would deliver them out of Egypt.