The Shaykh (Al-Mufid), may Allah سبحانه وتعالى support him, said: "It is not permissible for a man to pray while a woman is praying beside him or in the same row. And whenever he prays while she is aligned with him in his row, both of their prayers are invalid. It is appropriate that if her prayer coincides with his in the same room or similar setting, she should pray in such a way that her place of prostration is aligned with his feet at the time of his prostration. And likewise, if she prays following his prayer, her position should be as we have described."
Commentary #41