Answered by Shaykh Rami Nsour
Question: As salaamu alaykum
Is praying behind an Imam in a building separate to where he is actually praying valid? For example, a masjid has two buildings that are not attached but have a decent sized courtyard that separates them. If the men’s musala is in one building and the women’s in another, is the prayer of the women following the Imam valid?
Answer: Wa’alikum assalaam warahmatu Allah,
According to the Maliki madhab, it is disliked (makruh) to follow an imam that you cannot see due to a wall or a distance. The reason is that a person will not be able to know where in the prayer the imam is. The prayer will nonetheless be valid though.