Answered by Sayyidi Habib Umar bin Hafiz (may Allah protect him and benefit us by him)
Should a woman go out to pray in the mosque or is it better for her to pray at home?
As long as she finds people to pray with her in congregation in her house, and there is no other sound reason for her to go to the mosque, such as acquiring knowledge, serving the religion or calling to Allah, then her prayer at home is better. The Prophet ﷺ taught us that a woman’s prayer in her house is best. In fact, it is better for her to pray in an inner chamber inside her house than to pray in a larger more open room. She should not, however, neglect the congregational prayer, whichever room she prays in. She can pray with one or two other people according to what is easy for her.
However, if she does have the opportunity to call people to Allah or acquire knowledge of the Sacred Law that she does not have access to at home, then her leaving the house would be better. This is all in regard to seeking that which is best. As regards permissibility, then as long as she does not mix with men, dress immodestly or contravene the Sacred Law, then her going to the mosque is permissible since there is nothing prohibiting women from going to the mosques of Allah.
In the Shafi school, a woman may lead another woman in congregation