Prior to the construction of the mosque, the Prophet (ﷺ) offered the prayers at sheep-folds.
Sahih al-Bukhari Book 4, Hadith 100