In the name of Allah, the most Beneficent, the most Merciful.
In the masjid one should abstain from talking about worldly affairs, even if they are concerning things that may be permissible.
Allah (SWT) in the Holy Quran has said:
‘And the places of worship are for Allah, so invoke not any one along with Allah’. (Surah Jinn v.18)
Ali (Radiallahu Anhu) once said that “A time will come when Islam will be only for the namesake and the Quran will only be a symbol; there will be mosques but they will not resound with the praises of Allah.”
Saib Bin Yazid (Radiallahu Anhu) narrates that one day he was asleep in the mosque when someone threw a pebble to wake him up. He saw that it was Umar (Radiallahu Anhu) who had woken him up. Umar (Radiallahu Anhu) pointed to two men who were making noise in the mosque and asked Saib to catch hold of them and bring them to him. Accordingly, he brought them to Umar (Radiallahu Anhu). He asked them where they lived. They replied that they belonged to Taif. On hearing this, Umar (Radiallahu Anhu) said “if you had been residents of Madinah, I would have punished you for making noise in the mosque. However, I excuse you today because you have come from outside.”
Umar (Radialahu Anhu) was very strict in this matter. He did not tolerate the slightest disrespect to the mosque.
It is an act of great sin to talk about worldly matters, backbite or indulge in unnecessary and useless talks. Talking unnecessarily in masjid wipes out good deeds just as fire destroys wood; or as animals eat away grass. This way all virtues are destroyed totally. In a saying: A time will come on people when they will indulge in worldly talks and vain talks in masjid, so you must not sit with such people; Allah has no need for such people. (Sunan Baihaqi)
Only Allah Knows Best.
Reference: https://islamqa.org/ — edited by An-Nuur Press Agency