Immediately following his arrival in Medina, Mohammed let a place be cleaned for use a place of prayer. In principle, no building is necessary for Muslims to fulfill their ritual duty of prayer. A hadith says that believers should do their prayers wherever they find themselves at the appropriate hour, and that this raises that place to the status of masjid (a word for mosque, derived from the Arabic word 'sadj,' the place where one prostrates oneself). Islam is not an exclusively private faith though, but rather a communal faith, one that expresses itself in communal rituals.
The house built by the Prophet Mohammed in Medina can be imagined as having a large open courtyard surrounded by clay walls, with a shading roof on the south side. Another roof on the north side sheltered the poorest of the community as long-term guests of the house, with living quarters on either side of the courtyard. In other words, the house had a threefold meaning: firstly, it was the home of the Prophet; secondly, it was the social center of the community; and thirdly, it was of course the place of communal prayer. Following Mohammeds death, the first three Caliphs lived in the house. After Ali moved to Kufa (657 B.C.) it became a mosque.
The spread of Islam made it necessary to build mosques in the areas its followers conquered. These were places used both for worship and military roll call. Distinguishing themselves from the Jewish and Christian traditions, Muslims made Friday their day of prayer. At least on this one day, communal midday prayer was the duty of every Muslim, as it was also the day that the troops received their orders and listened to recitations from the Quran. These Friday gatherings were later stereotypically ritualized.
Garrison mosques, as one could call these first Islamic buildings, were most probably very simple facilities, making it no surprise that none have survived in their original state. Some descriptions of them have been passed down, however. For example, the mosque in Kufa, in today's Iraq, is said to have been a square construction of an arrow's length on each side, surrounded by a clay wall separating it from the profane and not always cleanly everyday life beyond. To protect from the burning sun, porticos with five naves were built on the qibla side and porticos with two naves
The Prophet's house certainly served as the model for the mosques that later came to be. This should remain the case in the next millenium as well.
Originally, in accord with the need for a place for military ceremony, it was planned to allow for only one "communal place of prayer" in every newly conquered city. However, as villages grew together, each with their own mosque, cities developed which had several Friday mosques. Additionally, ritual buildings were taken over from Christian or other traditions and adapted for Islamic rituals. These factors were not without influence upon the design and development of Islamic places of worship.
From the 9th century onwards, the word jami (Turkish: camii) came to be used to refer to any large mosque, and masjid (Turkish: mescit) only for small places of prayer such as those built in caravansaries. Further developments led to a proliferation of terms from masjid to the Ottoman külliye, corresponding to a similar situation in the Christian Occident with its churches, cathedrals, minsters, basilica, etc.
The names of mosques were completed with distinctive additions such as the names of donators and founders – for example, the Selimiye Camii in Edirne – or of distinguishing elements – for example, the three balconies for the muezzin at the Üc Serefeli Camii in Edirne, or the dominant green of the Yesil Camii in Bursa.