Sunan an-Nasa'i, Volume 2, Book 19, Hadith 1560 (DarusSalam)

It was narrated that Muhammad said: "I met Umm 'Atiyyah and said to her: 'Did you hear the Messenger of Allah say (anything)?' When she mentioned him, she would say: 'May my father be ransomed for him.' (He said) 'Bring out the adolescent girls and the women in seclusion and let them witness goodness and the supplication of the Muslims, but let the menstruating women keep away from the place where the people pray.'"

أَخْبَرَنَا قُتَيْبَةُ، قَالَ حَدَّثَنَا سُفْيَانُ، عَنْ أَيُّوبَ، عَنْ مُحَمَّدٍ، قَالَ لَقِيتُ أُمَّ عَطِيَّةَ فَقُلْتُ لَهَا هَلْ سَمِعْتِ مِنَ النَّبِيِّ صلى الله عليه وسلم وَكَانَتْ إِذَا ذَكَرَتْهُ قَالَتْ بِأَبَا قَالَ ‏ "‏ أَخْرِجُوا الْعَوَاتِقَ وَذَوَاتِ الْخُدُورِ فَيَشْهَدْنَ الْعِيدَ وَدَعْوَةَ الْمُسْلِمِينَ وَلْيَعْتَزِلِ الْحُيَّضُ مُصَلَّى النَّاسِ ‏" ‏ ‏.‏

sunnah.com