The Prohibition of Gathering for Worldly Talk in the Mosque

The famous Maliki scholar, Imam Ibn al-Hajj (D. 737AH) said:
“People should be prohibited from forming circles and sitting in groups in the masjid to talk about worldly matters, such as what happened to someone and what happened to another.” He then cited numerous narrations and said: “One should only sit in the masjid for prayer, recitation, remembrance, contemplation, or teaching knowledge, with the condition that there are no loud voices and no disturbance to those praying and remembering Allah.”
Ibn Hibban narrated from Ibn Mas‘ud, and al-Hakim narrated from Anas (radiyallahu ‘anhuma), al-Hakim said: It has a Sahih (authentic) chain of narration and it was narrated from the Prophet ﷺ that he said:
يأتي على الناس زمان يحلقون في مساجدهم وليس همهم إلا الدنيا وليس لله فيهم حاجة فلا تجالسوهم
“A time will come upon people when they will form circles in their mosques, and their concern will be nothing but the world. Allah has no need for such people, so do not sit with them.”
Shaykh al-Albani commented on the hadith: “This is a hasan (sound) hadith which I have authenticated in “al-Sahihah” (no.1163).
Source: Islah al-Masajid min al-Bida‘ wal-‘Awa’id (pp. 115-116) with the checking of Shaykh al-Albani.
Shaykh ‘Abdul-‘Aziz ibn Baz (rahimahullah):
“Having conversations in the masjid, if it is about worldly affairs which one would normally speak to his brothers and companions about, then there is no problem in this as long as it is little in sha’ Allāh. If it is a lot then this is disliked as making the masajid places for speaking about the dunya is disliked. Indeed, they are for the remembrance of Allah (dhikr), reciting the Qur’an, the five daily prayers and other than that from the avenues of good such as doing voluntary deeds, i‘tikaf and the gatherings of knowledge.
As for using the masjid for having conversations about the dunya then this is disliked. However, a little bit of speech is allowed from that which is a necessity. For example, when giving salam to your brother, whom you have gathered with, you may ask him regarding his wellbeing, his children or other things that are connected to him or to the affairs of the dunya however it should not be for long. Rather, it should be for a short time and there is no problem with that.”
Source: Fatawa Nur ‘ala al-Darb (11/345-346)