Umm Atiya reported,

Our Prophet ﷺ commanded us to bring out the young unmarried women and those secluded behind curtains.From Ayub, on the authority of Hafsah, a similar narration was reported. In the narration of Hafsah, he Wazad, "He said," or perhaps she said, "The young unmarried women and those secluded behind curtains should come out, but the menstruating women should keep away from the prayer area."

Bukhari 974

Sahih

حدثنا عبد الله بن عبد الوهاب قال حدثنا حماد بن زيد عن أيوب عن محمد

عن أم عطية قالت

أمرنا نبينا ﷺ بأن نخرج العواتق وذوات الخدور وعن أيوب عن حفصة بنحوه وزاد في حديث حفصة قال أو قالت العواتق وذوات الخدور ويعتزلن الحيض المصلى

البخاري 974صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Two Eids
Chapter
Women and menstruating women going out to the prayer place
Numbering
Darussalam 974
Bukhari 974