“I will go down with thee into Egypt; and I will also surely bring thee up again: and Joseph shall put his hand upon thine eyes.”
God gave Israel the land of Canaan as an everlasting possession. Abraham moved to settle in the land and both Isaac and Jacob kept the instruction. However in the time of Jacob, it seems God gave a contrary instruction.
A famine was ravaging the land, Joseph his lost son was now a governor in Egypt and responsible for all the grain and corn, which abounded in that land.
The Lord appeared to Jacob and asked him to move temporarily into Egypt; away from his destined inheritance Canaan. This period lasted for four hundred years. They returned to the land in the time of Moses.
When we walk with the Lord we must follow the voice of the Holy Spirit not dogma. God can even sometimes seem to give contrary instructions but in all that he will still be faithful to his word.
Keep on listening and follow the Spirit.