( وَقَالَ لِلَّذِي ظَنَّ أَنَّهُ نَاجٍ مِّنْهُمَا...) ( And he said to the one whom he knew would go free…): The word (knew) means that Yusuf (PBUH) was certain that this man would be freed.
(… اذْكُرْنِي عِندَ رَبِّكَ…) (…“Mention me before your master.”…):
Yusuf (PBUH) asked the prisoner, who will be freed, to tell the master about him (PBUH) and inform him that he is innocent and that he was wrongfully imprisoned.
(… رَبِّكَ…) (…your master…): Meaning, the king. This word may refer to the master of a household as well as to a king.
(… فَأَنسَاهُ الشَّيْطَانُ ذِكْرَ رَبِّهِ…) (…But Satan made him forget the mention [to] his master…): Some Qur’anic exegetes said that there are two explanations: Either Satan made this person forgot to mention Yusuf (PBUH), and so Yusuf remained in prison for a number of years. Second, Satan made Yusuf (PBUH) forgot that he should not ask anyone for assistance but from Allah (swt). The Prophet (saws) said:
“May Allah bestow His Mercy on Yusuf, if he has not said his word: “Mention me before your master”, he would not have remained in prison so long”. [1]
(... فَلَبِثَ فِي السِّجْنِ بِضْعَ سِنِينَ ) (… and Joseph remained in prison several years.):
That reward is an honor for Yusuf (PBUH). His salvation could not come through a person, even if he were a king. Rather, salvation can only come through the Hand of the King of kings (swt).
[1] Sahih ibn Haban: The Book of History, Chapter of Beginning of Creation, Hadith No. 6206.