وَقَالَ لِلَّذِى ظَنَّ أَنَّهُۥ نَاجٍ مِّنْهُمَا ٱذْكُرْنِى عِندَ رَبِّكَ فَأَنسَىٰهُ ٱلشَّيْطَٰنُ ذِكْرَ رَبِّهِۦ فَلَبِثَ فِى ٱلسِّجْنِ بِضْعَ سِنِينَ (12:42)
Joseph asked the one, whom he knew would not be executed, to mention his case to his Lord. Satan caused that man to forget all about Joseph and his case. Thus, Joseph remained in prison for some years.