The verse that preceded this verse speaks about the mosque, and that for mosques there are etiquettes and laws. The mosque is the house of Allah on earth and its visitors are those who establish it, as how our beloved prophet r has said.
The mosque is a piece of known land that has been put aside by man and it is defined to be a place of worship so that it will become a mosque for Allah. Hence a person may not do any other act in it.
﴾وَأَنَّ الْمَسَاجِدَ لِلَّهِ فَلا تَدْعُوا مَعَ اللَّهِ أَحَداً﴿
“And [He revealed] that the masjids are for Allah, so do not invoke with Allah anyone.” [Surah Al-Jinn: 18]