God told the Israelites not to go back to Egypt. But the things the Egyptians offered to Israel looked inviting. God doesn't want us to live in sin. But sometimes the things satan has to offer are tempting. How do I stay out of Egypt (sin)? How do I come back to God after living in sin?
The Israelites were being tempted to go back to Egypt. The Egyptian's had horses to offer them and Israel wanted them for their army. In Isaiah 30:1-7, God is warning them not to go back to Egypt. In Isaiah 31:1-3 He again warns them not to go to Egypt and put their trust in men and horses and chariots.
God wanted them to trust completely in Him, but the things the Egyptians had to offer looked good to Israel. Israel imagined that what Egypt had to offer was for its own protection and good. In Isaiah 31:3 God warns them that whoever goes to Egypt shall perish with the Egyptians.
We can be like the Israelites as well. God wants us to fully trust him and not "go down to Egypt". He doesn't want us going to the world for what appears to be something satisfying. The world has nothing to offer that will satisfy.
So why do people "go to Egypt"?
Sometimes we find ourselves "in Egypt". We have turned to the world and satan for the pleasures they have to offer. How do we "return from Egypt" and come back to God?