“Get up!” he said. “Take the Child and His mother and go to the land of Israel, for those seeking the Child’s life are now dead.”
The angel tells Joseph to take the child and his mother to the land of Israel because the threat has ended.
This verse gives the command to return.
19After Herod died, an angel of the Lord appeared in a dream to Joseph in Egypt. 20“Get up!” he said. “Take the Child and His mother and go to the land of Israel, for those seeking the Child’s life are now dead.” 21So Joseph got up, took the Child and His mother, and went to the land of Israel. 22But when he learned that Archelaus was reigning in Judea in place of his father Herod, he was afraid to go there. And having been warned in a dream, he withdrew to the district of Galilee, 23and he went and lived in a town called Nazareth. So was fulfilled what was spoken through the prophets: “He will be called a Nazarene.”