Some of the unbelievers put this question to test the Prophet (peace be upon him): “Why did the Israelites go to Egypt?"
This question was asked because they knew that their story was not known to the Arabs for there was no mention of it whatever in their traditions and the Holy Prophet had never even referred to it before. Therefore, they expected that he would not be able to give any satisfactory answer to this question or would first evade it, and afterwards try to inquire about it from some Jew, and thus he would be totally exposed. But, contrary to their expectations, the tables were turned on them, for Allah revealed the whole story of Prophet Joseph then and there, and the Holy Prophet recited it on the spot. This put the Quraish in a very awkward position because it not only foiled their scheme but also administered a warning to them by aptly applying it to their case, as if to say, "As you are behaving towards this Prophet, exactly in the same way the brothers of Prophet Joseph behaved towards him; so you shall meet with the same end."
Prophet Joseph was a son of Prophet Jacob and a grandson of Prophet Isaac and a great grandson of Prophet Abraham (Allah's peace be upon them all). The Bible says (and the allusions in the Quran also confirm this) that Prophet Jacob had twelve sons from four wives. Prophet Joseph and his younger brother Benjamin were from one wife and the other ten from the other wives. Prophet Jacob had settled at Hebron (Palestine) where his father Prophet Isaac and before him Prophet Abraham lived and owned a piece of land at Shechem as well.
According to the research scholars of the Bible, Prophet Joseph was born in 1562 B. C. He was seventeen when he saw the dream and was thrown into the well. This well was near Dothan to the north of Shechem according to Biblical and Talmudic traditions, and the caravan, which took him out of the well, was coming from Gilead (Trans-Jordan), and was on its way to Egypt.
At that time Fifteenth Dynasty ruled over Egypt, whose rulers are known in history as the Hyksos kings. They belonged to the Arab race, but had migrated from Palestine and Syria to Egypt in or about 2000 B. C. and taken possession of the country. The Arab historians and the commentators of the Quran have given them the name of Amaliq (the Amalekites), and this has been corroborated by the recent researches made by the Egyptologists. They were foreign invaders who had got the opportunity of establishing their kingdom because of the internal feuds in the country. That is why there was no prejudice in the way of Prophet Joseph's ascendancy to power and in the subsequent settlement of the Children of Israel in the most fertile region of Egypt.
They could gain that power and influence which they did, because they belonged to the same race as the foreign rulers of Egypt. The Hyksos ruled over Egypt up to the end of the fifteenth century B. C., and practically all the powers remained in the hands of the Israelites. The Quran has made a reference to this in v. 20 of AlMa'idah: “...He raised Prophets among you and made you rulers.” Then there arose a great nationalist movement which overthrew the power of this dynasty and exiled 250,000 or so of the Amalekites. As a result of this, a very bigoted dynasty of Copts came into power and uprooted everything connected with the Amalekites. Then started that persecution of the Israelites which has been mentioned in connection with the story of Prophet Moses.
We also learn from the history of Egypt that the "Hyksos kings" did not acknowledge the gods of Egypt and, therefore, had imported their own gods from Syria, with a view to spreading their own religion in Egypt. This is the reason why the Quran has not called the king who was the contemporary of Prophet Joseph by the title of "Pharaoh," because this title was associated with the religion of the original people of Egypt and the Hyksos did not believe in it, but the Bible erroneously calls him "Pharaoh." It appears that the editors of the Bible had the misunderstanding that all the kings of Egypt were "Pharaohs."
The modern research scholars who have made a comparative study of the Bible and the Egyptian history are generally of the opinion that Apophis was the Hyksos king, who was the contemporary of Prophet Joseph.
At that time Memphis was the capital of Egypt, whose ruins are still found on the Nile at a distance of 4 miles south of Cairo. Joseph remained in the house of Aziz for three years and spent nine years in prison, and then became the ruler of the land at the age of thirty and ruled over Egypt independently for eighty years. In the ninth or tenth year of his rule he sent for his father, Prophet Jacob, to come from Palestine to Egypt with all the members of his family and, according to the Bible, settled them in the land of Goshen, where they lived up to the time of Prophet Moses. The Bible says that before his death, Prophet Joseph bound his kindred by an oath: "when you return from this country to the house of your forefathers you must take my bones out of this country with you. So he died a hundred and ten years old, and they embalmed him..."
Though the story of Prophet Joseph as given in the Quran differs very much in its details from that given in the Bible and the Talmud, the Three generally agree in regard to its component parts.
"Thus will thy Lord choose thee and teach thee the interpretation of stories (and events) and perfect His favour to thee and to the posterity of Jacob - even as He perfected it to thy fathers Abraham and Isaac aforetime! for Allah is full of knowledge and wisdom." (Quran 12:6)
If Joseph was to be of the elect, he must understand and interpret Signs and events aright. The imagination of the pure sees truths, which those not so endowed cannot understand. The dreams of the righteous prefigure great events, while the dreams of the futile are mere idle futilities. Even things that happen to us are often like dreams. The righteous man receives disasters and reverses, not with blasphemies against Allah, but with humble devotion, seeking to ascertain His Will. Not does he receive good fortune with arrogance, but as an opportunity for doing good to friends and foes alike. His attitude to histories and stories is the same; he seeks the edifying material which leads to Allah. In Joseph's case he could look back to his fathers, and to Abraham, the True, the Righteous, who through all adversities kept his Faith pure and undefiled, and won through.