It is narrated from Sayyidah Umm Salamah (may Allah be pleased with her); she said: The Messenger of Allah (peace and blessings be upon him) came out to the mosque and called out in his loudest voice: "Listen! This mosque is not lawful for anyone in a state of major ritual impurity (janabah), nor for a menstruating woman, except for the Prophet, his wives, Fatimah bint Muhammad and Ali. Behold! I have made this ruling clear to you so that you do not go astray."
Hadith Referenceالمعجم الكبير للطبراني / مسند النساء / 20185