Why did God allow Joseph to become a slave and a prisoner in Egypt? Why was there a great famine for 7 years?
If we will look at all the stories in the Bible in the context of Gen. 3:15, we would see how Satan tried to destroy the lineage from which the “Seed” would be coming from. And we would also see how God preserved and protected the holy lineage of the “Seed.”
The story of Joseph is just one of the many examples.
Satan tried to kill the brothers of Joseph through famine, because he knows that the Messiah will come from the line of Judah. But God knows how to save His people, for He sent Joseph ahead in Egypt to be a slave and a prisoner, and eventually became the Prime Minister. He stored all the excess food to be distributed and consume during the 7 years of famine and to save the lives of the people and his brothers.
In Joseph’s own words in Genesis 45:5-7, he said, “…for God send me before you to preserve life. For these two years hath the famine been in the land: and yet there are five years, in the which there shall neither be earing nor harvest. and God sent me before you to preserve you a posterity in the earth, and to save your lives by a great deliverance.”