As time passed by, Yusuf NabiAS found himself in great trouble. He prayed to Almighty Allah to grant him protection from those women. He expressed his wish to be in prison rather than being indecent. As Allah quotes him in Al Quran-al-Kareem:
“He said: “O my Lord! The prison is more to my liking than that to which they invite me: Unless You turn away their snare from me, lest I may feel inclined towards them and join the ranks of the ignorant.”
Allah accepted his prayers and saved him from their snare. The king of Misr and his men knew that Yusuf NabiAS had committed no crime yet they decided to imprison him.
Now with him came into the prison two young men. It is said that one was the king’s cup-bearer and the other was the king’s baker (who took care of his food). One night each of them saw a strange dream and narrated it to Yusuf NabiAS so that he may interpret their dreams for them.The Quran thus narrates this incident: Said one of them: “I see myself (in a dream) pressing wine.” said the other: “I see myself (in a dream) carrying bread on my head, and birds are eating from it.” “Tell us (they said) the truth and meaning of the dreams: for we see that you are one that does good to all.”
Yusuf NabiAS asked them to wait until the next meal and he promised them that he would explain to them the meaning of the dreams before the food was served, saying that it was an element of what Allah had taught him.
As per his promise, Yusuf NabiAS explained: The one who was pressing wine, will be set free and he will serve wine to his master, while the other will be crucified and birds will eat from off his head.
Very soon the interpretations of those dreams turned out to be true. Yusuf NabiAS asked the one who was set free (the cup-bearer) to remind his master about the plight in which Yusuf NabiAS was. But the man forgot and so Yusuf NabiAS had to stay imprisoned for a few more years, (some believe it to be four and some nine)
One day, the king of Egypt saw in a dream that seven fat cows were eaten by seven thin cows and he also saw seven green ears of corn and seven others that were withered. The king asked his courtiers to interpret this strange dream, but everyone was baffled and a few even said: “A confused medley of dreams: and we are not skilled in the interpretation of dreams.” It was then that the cup-bearer remembered Yusuf NabiAS and said to the king: “I will tell you the truth of its interpretation: therefore send me (to Yusuf Nabi)AS.”
When the cup-bearer came to Yusuf NabiAS and narrated the dream. Yusuf NabiAS interpreted it thus:
“For seven years you will diligently sow as you always do: and the harvests that you reap, you must leave them in the ear, except a little, of which you will need to eat. Then will come after that seven dreadful years, which will devour what you will have laid by in advance, except a little of which you will have (specially) guarded. Then will come after that period a year in which the people will have abundant water, and in which they will press for juice.”