There is little relationship between what happens in religious rituals, and real life, and the latter is what matters.

Many religions separate the genders for services simply so that the focus is on the ritual rather than the social aspects.

In the case of Islam, there is another, practical consideration, that Muslims prey by prostrating themselves, and no woman wants to pray with her bum in a man's face...being in the back or separate is quite practical.

The downside is that means they are often given shabbier quarters far from the action, and are treated as an afterthought...

What is more concerning is when the gender separation becomes a principle in everyday life, but that is not all versions of Islam.