Estrangement from people comes about as a result for knowing them too well.”
~ Imam al-'Askari (AS).
Living far away from people or being gregarious in a way you enjoy being with them, estrangement or formed a coalition with people is a subject our scholars have different opinion about. Some say: it is better to estrange from people than being with them instead, according to some traditions in which we are recommended to be so.
Others say: it is better to serve the society, keep company, cooperating and become familiar with people, according to some traditions like al-amr bi-l-maʿrūf wa-n-nahy ʿani-l-munkar (bid what is right and forbid what is wrong) and the following verses of the Holy Quran.
1. “Hold fast, all together, to Allah's cord, and do not be divided [into sects]” (1)
2. “Cooperate in piety and God wariness” (2)
According to Ibin Maitham Bahrani (May His soul rest in peace), the both reasons and arguments would be considered as Sahih. No one if preferable to the other at all. For instance, probably, a Dr. prescribed a medicine for a person which is suitable for curing him and it’s not appropriate for another one with different symptom of illness.
It is said that living far away from people or being with them depends on each person’s piety, knowledge and faith. E.g. how many knowledgeable person who is considered as a scholar can guide people to the straight path, so, the one is supposed to cooperate in piety and Allah wariness. On the other hand, there are many people who would commit sin if they join a company where committing sin is provided for him easily. So, the one is strongly recommended to estrange from such people encourage him commit sin.
There are some traditions in which our Imams (AS) tell us to estrange from people in order to know Allah (SWT) better. First step, if we want Allah (SWT) to love us, it is recommended to keep away from those people who encourage you to commit sin, as Imam Hasan Askari (AS) says. If one wants to become familiar or get closer to Allah (SWT), the Almighty, then one should estrange from people because, one of the signs of being a good believer is to do this. (3)
Preserving our faith in situations where people are committing sins can be really difficult. There is a Hadith of Imam Ali (AS) where he says, “If you detect the effects of others you wouldn’t like even to inter him.” (4)
Being aloof is required if we really want to know Allah (SWT) better. We have to know Allah (SWT) and try to talk to Him all the time, instead of getting familiar with people whom we don't know.
Therefore, sometimes, estrangement from people is advisable for some people to keep away themselves from those haram gatherings where there is nothing but play and diversion, ignorance and senseless, backbiting and lying. (5)
Please, keep in mind that observing bonds of marriage and family are completely different. The hadith is not trying to include these kinds of relationships because, we are strongly recommended to be in touch with our close relationships.
References: (1) Surah A’le Imran, verse 103. Tafsir al-Mizan, Vol. 3, Pg. 572. (2) Surah al-Maedah, verse 2. Tafsir al-Mizan, Vol. 5, Pg. 266. (3) Musnad of Imam Hasan al-Askari, Pg. 287; The Scale of Wisdom, A Compendium of Shia Hadith, Bilingual Edition, M Muhammadi Rayshahri, The Book of Solitude, hadith 4239, Page 738; Ghurar al-Hikam, no.10187. (4) Al-Amali (of Shaykh Saduq), al-Nass, Pg. 446. (5) Nahj al-sa'adah fi mustadrak Nahj al-balagha, Vol. 7, Pg. 106-109.
source : islamquest