The tomb later became part of the mosque when it was expanded by the Umayyad Caliph Al-Walid I. The first mosque of Islam is also located in Medina . It is known as Masjid Quba , ( the Quba Mosque ) . Medina is home to the three oldest mosques in Islam , namely ; Al-Masjid al-Nabawi ( The Prophet 's Mosque ) , Quba Mosque ( the first mosque in Islam 's history ) , and Masjid al-Qiblatain ( the mosque where the qibla was switched to Mecca ) .