Even during times when the pagan Arabs performed their rituals inside the Kaaba, Muhammad always held the Kaaba in very high esteem. The Meccan tribe of Quraish, which was responsible for guarding Kaaba, attempted to exclude Muhammad's followers from the sanctuary, which became a subject of Muslim complaints recorded in the Qur'an. When Muhammad conquered Mecca in 630, he converted Kaaba to a mosque, which has since become known as the Masjid al-Haram, or Sacred Mosque. The Masjid al-Haram was significantly expanded and improved in the early centuries of Islam in order to accommodate the increasing number of Muslims who either lived in the area or made the annual Hajj, or pilgrimage, to Mecca, before it acquired its present shape in 1577 in the reign of the Ottoman sultan Selim II.
The first thing Muhammad did upon arriving with his followers near Medina (then named Yathrib) after the emigration from Mecca in 622 was build the in a village outside Medina. Muslims believe he stayed at the Quba Masjid for three days before moving on to Medina.
Just days after beginning work on the Quba Mosque, Muhammad went on to establish another masjid in Medina, known today as the Masjid al-Nabawi, or the "prophet's" Masjid. The location of the mosque was declared as such after it hosted Muhammad's first Friday prayer. Following its establishment, the Masjid al-Nabawi continued to introduce some of the practices now considered common in today's mosques. For example, the adhan, or call to prayer, was developed in the form still used in masjids today. The Masjid al-Nabawi was built with a large courtyard, a motif common among mosques built since then. Muhammad would stand up at one end of the arcade to preach. Later on, he would develop a three-step pulpit as a platform from which he would give sermons. The pulpit, now known as a minbar, is still a common feature of masjids.
Muhammad lived beside the masjid in Medina, which doubled as both a religious and political center for the early Muslim community. Negotiations were conducted, military actions planned, prisoners of war held, disputes settled, religious information disseminated, gifts received and distributed among his companions. His followers treated the wounded there and some people even lived in the mosque permanently in tents and huts.
Today, the Masjid al-Haram in Mecca, the Masjid al-Nabawi in Medina and Al Aqsa in Jerusalem are considered the three holiest sites in Islam.
Diffusion and evolutionMosques were built outside the Arabian Peninsula as Muslims moved to other parts of the world. Egypt became occupied by Muslim Arabs as early as 640, and since then so many mosques have appeared throughout the country that its capital city, Cairo, has acquired the nickname of city of a thousand minarets. Egyptian mosques vary in amenities, as some have Islamic schools (madrassas) while others have hospitals or tombs. Mosques in Sicily and Spain do not primarily reflect the architecture of Visigothic predecessors, but instead reflect the architecture introduced by the Muslim Moors. It is hypothesized, however, that there were some elements of pre-Islamic architecture which were Islamicized into Andalusi and Maghribi architecture, for example, the distinctive horseshoe arch.
The first Chinese mosque was established in the eighth century in Xi'an. The Great Mosque of Xi'an, whose current building dates from the eighteenth century, does not replicate many of the features often associated with traditional mosques. Instead, it follows traditional Chinese architecture. It is distinguished from other building by its green roof (Buddhist temples are often built with a yellow roof). Mosques in western China incorporate more of the elements seen in mosques in other parts of the world. Western Chinese mosques were more likely to incorporate minarets and domes while eastern Chinese mosques were more likely to look like pagodas.
Mosques diffused into India during the reign of the Mughal empire in the sixteenth and seventeenth centuries. The Mughals brought their own form of architecture that included pointed, onion-shaped domes, as seen in Delhi's Jama Masjid.
Mosques first arrived in the Ottoman Empire (mostly present-day Turkey) during the eleventh century, when many of the Turks in the region began to convert to Islam. Several of the first mosques in the Ottoman Empire, such as the Hagia Sophia in present-day Istanbul, were originally churches or cathedrals in the Byzantine Empire. The Ottomans created their own design of mosques, which included large central domes, multiple minarets, and open façades. The Ottoman style of mosques usually included elaborate columns, aisles, and high ceilings in the interior, while incorporating traditional elements, such as the mihrab. Today, Turkey is still home to many mosques that display this Ottoman style of architecture.
Mosques gradually diffused to different parts of Europe, but the most rapid growth in the number of mosques has occurred within the past century as more Muslims have migrated to the continent. Major European cities, such as Rome, London, and Munich, are home to mosques that feature traditional domes and minarets. These large mosques in urban centers are supposed to serve as community and social centers for a large group of Muslims that occupy the region. However, one can still find smaller mosques in more suburban and rural regions throughout Europe where Muslims populate. Mosques first appeared in the United States in the early twentieth century, the first of which was built in the late 1920s in Cedar Rapids, Iowa. However, as more immigrants continue to arrive in the country, especially from South Asia, the number of American mosques is increasing faster than ever before. Whereas only two percent of the country's mosques appeared in the United States before 1950, eighty-seven percent of American mosques were founded after 1970 and fifty percent of American mosques founded after 1980.
Conversion of places of worshipAccording to early Muslim historians, towns that surrendered without resistance and made treaties with the Muslims received permission to retain their churches and synagogues, One of the earliest examples of these kinds of conversions was in Damascus, Syria, where in 705 Umayyad caliph Abd al-Malik took the church of St. John from the Christians and had it rebuilt as a mosque, which is now known as Umayyad Mosque; overall, Abd al-Malik is said to have transformed 10 churches in Damascus into mosques. The process of turning churches into mosques was especially intensive in the villages. The Abbasid caliph al-Ma'mun turned many churches into mosques. Ottoman Turks converted into mosques nearly all churches, monasteries, and chapels in Constantinople, including the famous Hagia Sophia, immediately after capturing the city in 1453. In some instances mosques have been established on the places of Jewish or Christian sanctuaries associated with Biblical personalities who were also recognized by Islam. Muslim rulers in India built mosques seeing their actions as fulfillment of religious duty
On the other hand, mosques have also been converted for use by other religions, notably in southern Spain, following the conquest of the Moors in 1492. The most prominent of them is the Great Mosque of Cordoba. The Iberian Peninsula, Southeast Europe, and India (the Babari Masjid incident) are other regions in the world where such instances occurred once no longer under Muslim rule.
Source : http://www.mosque.net/about/history.php