The Imam of the Jama’at stands in front of those who are following him. The followers are behind him, forming straight lines each standing close to the other one’s shoulders. As for the distance between the rows, according to Ihtiyat Mustahab, it should be just enough to allow the person to perform Sajdah.
When there are only two people in Salat al-Jama’at, the Imam and the Ma’mum, then it is Mustahab that the Ma’mum position himself just behind the Imam on his right side, although, he can also stand in line with the Imam.
When there are many followers, according to Ihtiyat Wajib, the followers must not stand beside the Imam, rather they must be behind him.
If during the course of the Salat al-Jama’at, a person finds that he is distanced from the preceding line by a foot or more, then since he is isolated from the Jamaat, he should change his intention from Salat al-jamaat to Furada (single prayer) amd continue his prayers as such.