In #genesis 47:29-30, Jacob asked Joseph to promise that he would not bury him in Egypt, but carry his remains back to Canaan and bury him with Abraham. While he meant this literally, he also did not want his descendants to stay in Egypt forever either. He prayed to Joseph to carry his bones back to his fathers and simultaneously prayed to Messiah, represented in the person of Joseph, to carry his children back to the Promised Land also.
On another level of midrash, there is a lesson here for us too. When you have died to your old, sinful self, you shouldn't remain in spiritual Egypt. Your environment needs to change: friends, hobbies, job, church, city, etc... One or more will probably have to go.