The Messenger of Allah (may Allah’s peace and blessings be upon him) ordered us to bring out the young girls and the girls who stay home on the two Eid days, and ordered the menstruating women to distance themselves from the praying area of the Muslims
Umm ‘Atiyyah reported: The Messenger of Allah (may Allah’s peace and blessings be upon him) ordered us to bring out the young girls and the girls who stay home on the two Eid days, and ordered the menstruating women to distance themselves from the praying area of the Muslims. In another version of the Hadīth: “We have been ordered to come out on the Day of Eid, even bring out the virgin girls from their houses and the menstruating women; so they would say Takbīr along with them, invoke Allah along with them; hoping for the blessings of that day and its purification.”
Explanation
That is why the Messenger (may Allah's peace and blessings be upon him) ordered all of the women, even the young girls who remain in their homes and the menstruating women, to exit with the Muslims and attend this assembly, provided that they stay away from the area of worship; to attend the great day and supplication of Muslims. They will obtain thereupon some goodness and blessing of that day, and the mercy of Allah and His pleasure.
Attending the two Eids' prayer is a communal obligation on the Muslims.