"And he was put in a coffin in Egypt"
The Zohar expands upon the wisdom concealed inside the verse "And he was put in a coffin (also: 'ark') in Egypt." Egypt, we're told, is the land of the Other Side, and though one may leave the world from this negative, foreign soil, the soul will merge with the Shechinah, as Joseph did, if it is righteous.
The strength to rise above of the negativity and influence of our Evil Inclination [Egypt] is ignited, so that we may connect to the protective and nurturing Light of the Shechinah now, and in the World to Come.
860. "And he was put in a coffin (also: 'ark') in Egypt" (Beresheet 50:26). From this verse, we learn yet another secret. Though his soul departed in a foreign soil OF THE OTHER SIDE, it joined the Shechinah and "he was put in an ark," IN THE ARK above and IN THE ARK below. For he was righteous, and every righteous man inherits the Holy, Supernal Land, THE SHECHINAH, as it says, "Your people also shall be righteous, they shall inherit the land forever; they shall be the branch of My planting, the work of My hands, that I may be glorified" (Yeshayah 60:21).
860. וַיִּישֶׂם בָּאָרֹן בְּמִצְרָיִם, הָכֵי הוּא וַדַּאי. וּקְרָא אוֹכַח רָזָא אָחֳרָא דְּאַף עַל גַּב דְּנָפְקַת נִשְׁמָתֵיהּ בִּרְשׁוּ אָחֳרָא, אִתְקַשַּׁר בִּשְׁכִינְתָּא, הֲדָא הוּא דִכְתִיב, וַיִּישֶׂם בָּאָרוֹן, לְעֵילָא וּלְתַתָּא, בְּגִין דַּהֲוָה צַדִּיק, דְּכָל צַדִּיק יָרֵית אַרְעָא קַדִּישָׁא עִלָּאָה, כְּד"א וְעַמֵּךְ כֻּלָּם צַדִּיקִים לְעוֹלָם יִרְשׁוּ אָרֶץ נֵצֶר מַטָּעַי מַעֲשֵׂה יָדַי לְהִתְפָּאֵר.