Allah, the Blessed and Exalted, says: "And purify your garments." [Surah al-Muddaththir: 4]
Imam al-Shafi'i (may Allah have mercy on him) said: "One view is that it means: pray in pure garments; and other views besides this have also been stated, but the first view seems the most correct, because the Messenger of Allah (peace and blessings be upon him) ordered that menstrual blood be washed from the garment."
It is narrated from Sayyidah Asma' (may Allah be pleased with her) that a woman came to the Prophet (peace and blessings be upon him) and said: If menstrual blood gets on the clothes of one of us, what should she do? He (peace and blessings be upon him) said: "She should scrape it off, then clean it with water, then sprinkle water over it, and then pray in it."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4083