"Then a new king, who did not know about Joseph, came to power in Egypt. 'Look,' he said to his people, 'the Israelites have become much too numerous for us. Come, we must deal shrewdly with them or they will become even more numerous and, if war breaks out will join our enemies, fight against us and leave the country.'" NIV translation
As life continued in Egypt the old king that had shown Joseph favor died and was replaced. This new king did not know what Joseph had done for Egypt and thought of the Israelites as possible enemies. This ignorance of what Joseph had done for them brought fear and this fear caused the Egyptians to change from being a refuge to becoming a prison for the Israelites. The same thing can happen in our walk with the Lord (if we allow it). Fear is not of God and, if we let it into our hearts, it can lead us to do things that we would not normally do. When we face troubles, our reaction can be to remember what God has already done on our behalf and have faith in Him or we can act in fear on our own.