The Prophet (may Allah's peace and blessings be upon him) informed that this worldly life is like a prison for the believer, due to his commitment to religious duties—doing what is commanded and avoiding what is prohibited. When he dies, he finds relief from this and transitions to the everlasting bliss that Allah Almighty has prepared for him. As for the disbeliever, this life is like a paradise for him, as he indulges in whatever his soul desires and his whims dictate. But when he dies, he transitions to the everlasting punishment that Allah Almighty has prepared for him on the Day of Judgment.
Lessons
An-Nawawi said: Every believer is imprisoned and restrained in this world from forbidden and disliked desires and is obligated to perform difficult acts of obedience. When he dies, he is relieved of all that and transitions to what Allah Almighty has prepared for him—everlasting bliss and complete comfort, free from any deficiency. As for the disbeliever, whatever pleasure he had in this world was limited and tainted with disturbances. When he dies, he transitions to eternal punishment and everlasting misery.
As-Sindi said: His statement "a prison for the believer" means that even if the believer is living in comfort, Paradise is better for him than this world. And "a paradise for the disbeliever" means that even if he is in hardship, Hellfire is worse for him than this world.
The insignificance of worldly life in the sight of Allah Almighty.
The worldly life is a place of trial and test for the people of faith.
The disbeliever hastened his paradise in this worldly life, and was punished by being deprived of the Paradise and the bliss of the Hereafter.
Explanation in Arabic
أخبر النبي صلى الله عليه وسلم أن الحياة الدنيا للمؤمن كالسجن لالتزامه بالتكاليف الشرعية من فعل المأمور وترك المحذور، فإذا مات استراح من هذا وانقلب إلى ما أعد الله تعالى له من النعيم الدائم، وهي للكافر كالجنة؛ لأنه يفعل فيها كل ما تشتهيه نفسه ويأمره به هواه، فإذا مات انقلب إلى ما أعد الله تعالى له يوم القيامة من العذاب المقيم.
قال النووي: كل مؤمن مسجون ممنوع في الدنيا من الشهوات المحرمة والمكروهة، مكلف بفعل الطاعات الشاقة، فإذا مات استراح من هذا، وانقلب إلى ما أعد الله تعالى له من النعيم الدائم، والراحة الخالصة من النقصان، وأما الكافر فإنما له من ذلك ما حصل في الدنيا مع قلته وتكديره بالمنغصات، فإذا مات صار إلى العذاب الدائم، وشقاء الأبد.
قال السندي: قوله (سجن المؤمن) فإنه وإن كان في نعمة فالجنة خير له منها، (وجنة الكافر) فإنه وإن كان في مقيتة فالنار شر له منها.
هوان الدنيا على الله تعالى.
الدنيا دار ابتلاء وامتحان لأهل الإيمان.
الكافر استعجل جنته في دنياه؛ فعوقب بحرمان جنة الآخرة ونعيمها.