Quba is the place on the outskirts of Madinah where the Prophet صَلَّى الله عَلَيْهِ وَسَلِّمَ, accompanied by Abu Bakar رضي الله عنه arrived and first stayed after emigrating from Makkah. They arrived on Monday 12th Rab’i al-Awwal, fourteen years after Prophethood and this date marks the beginning of the Islamic calendar (Hijrah). (16th July 622 CE). A mosque was established here by the Prophet صَلَّى الله عَلَيْهِ وَسَلِّمَ , the first to be built in the history of Islam.
It is mentioned in the Qur'an as the mosque founded on piety and devoutness (Masjid al-Taqwa). The virtue of Quba Mosque is mentioned in the following Quranic verse in Surah Taubah:
لا تَقُمْ فِيهِ أَبَدًا لَمَسْجِدٌ أُسِّسَ عَلَى التَّقْوَى مِنْ أَوَّلِ يَوْمٍ أَحَقُّ أَنْ تَقُومَ فِيهِ فِيهِ رِجَالٌ يُحِبُّونَ أَنْ يَتَطَهَّرُوا وَاللَّهُ يُحِبُّ الْمُطَّهِّرِينَ (١٠٨)
Never stand you therein. Verily , the mosque whose foundation was laid from the first day on piety is more worthy that you stand therein (to pray). In it are men who love to clean and to purify themselves. And Allah loves those who make themselves clean and pure [ i.e. who clean their private parts with dust (which has the properties of soap) and water from urine and stools, after answering the call of nature]. (At-Taubah 9:108)
Prophet Muhammad صَلَّى الله عَلَيْهِ وَسَلِّمَ used to go there, riding or on foot, every Saturday and offer a two units (rakaat) prayer. He advised others to do the same, saying, "Whoever makes ablutions at home and then goes and prays in the Mosque of Quba, he will have a reward like that of an 'Umrah." This hadith is reported by Ahmad ibn Hanbal, Al-Nasa'i, Ibn Majah and Hakim al-Nishaburi.