Ibn Umar reported: The Prophet, peace and blessings be upon him, prohibited isolation, that a man spend the night alone or travel alone.
Source: Musnad Aḥmad 5650
Grade: Sahih (authentic) according to Ahmad Shakir
Al-Tabari said, “This is discouragement in the form of discipline and guidance, as it is feared that one alone might succumb to loneliness and isolation, yet it is not unlawful. The lone traveler in the wilderness and likewise the lone resident in his house are not safe from succumbing to loneliness, especially if one is afflicted by bad thoughts and a weak heart.”
Source: Fatḥ al-Bārī 2693
عَنِ ابْنِ عُمَرَ أَنَّ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ نَهَى عَنْ الْوَحْدَةِ أَنْ يَبِيتَ الرَّجُلُ وَحْدَهُ أَوْ يُسَافِرَ وَحْدَهُ
5650 مسند أحمد
5/164 المحدث أحمد شاكر خلاصة حكم المحدث إسناده صحيح في مسند أحمد
وَقَالَ الطَّبَرِيُّ هَذَا الزَّجْرُ زَجْرُ أَدَبٍ وَإِرْشَادٍ لِمَا يُخْشَى عَلَى الْوَاحِدِ مِنَ الْوَحْشَةِ وَالْوَحْدَةِ وَلَيْسَ بِحَرَامٍ فَالسَّائِرُ وَحْدَهُ فِي فَلَاةٍ وَكَذَا الْبَائِتُ فِي بَيْتٍ وَحْدَهُ لَا يَأْمَنُ مِنْ الِاسْتِيحَاشِ لَا سِيَّمَا إِذَا كَانَ ذَا فِكْرَةٍ رَدِيئَةٍ وَقَلْبٍ ضَعِيفٍ
6/53 فتح الباري شرح صحيح البخاري