This literally means a "place of prostration," and is used to refer to a shrine or mosque where people come in groups to pray. Larger mosques are also known as jami', which means "place of congregating together).
The masjid is a sanctified area, in which the rewards of prayers in congregation increase 25 to 27 times and where the mercy of Allah descends. It is considered the best of places by the Messenger of Allah (upon him be peace). Ibn 'Abbas (may Allah be pleased with him) relates:
Masjids are the houses of Allah on the earth. They shine up to the inhabitants of the heavens just as the stars in the sky shine down to the inhabitants of the earth (Tabarânî).
A true masjid, in the legal sense, is a place that has been permanently dedicated to Allah for the sake of prayer, recitation, and His remembrance. Any piece of land that has been dedicated permanently for the sake of congregational prayers will also become a proper masjid.
However, once a masjid is erected, it will always be a masjid and the property of Allah. It cannot return to being the property of any person or community even those who may have paid for establishing it.