If the only person standing next to a worshipper is an unbeliever, a woman, someone whom either of them knows to be in minor impurity, or a boy in an obligatory prayer, he is deemed to be praying alone. Whoever finds a gap in the row must fill it; failing that, he should stand to the imam’s right. If even that is impossible, he may signal someone to join him. Should he complete one full rakʿah by himself, the prayer is invalid; but if he bows alone and then joins the row, or another person joins him before the imam prostrates, the prayer is valid.
Section
A follower’s prayer behind an imam inside the mosque is valid even if he sees neither the imam nor those behind him, provided he can hear the takbir. The same applies outside the mosque, so long as he can see the imam or the congregation1 and the rows remain connected2.
Prayer behind an imam who is elevated above the congregation is valid but disliked when the elevation is a cubit or more—for example, leading from within a niche. It is likewise disliked for him to perform a voluntary prayer in the very place where he led the obligatory one, except when there is a need3. Prolonging his sitting after the prayer while facing the qiblah is also discouraged; if women are present, he should remain only briefly so they may depart. It is reprehensible for worshippers to stand between the pillars when that breaks the continuity of the rows4.