Abu al-Walid said: I asked Ibn Umar (may Allah be pleased with them both): How did the pebbles in the mosque begin? He said: Yes; it rained during the night, and when we went out for the morning prayer, each person, passing over the Batha, took some pebbles in his garment, spread them beneath him and offered the prayer on them. When the Prophet (peace and blessings be upon him) saw this, he said: "How fine a carpet this is!" That is how the pebbles in the mosque began.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4313