Reference: Fataawa tata’allaq bi-Jamaa’tut-Masjid – Question 40, Page 37
Majmoo al-Fataawa wal-Maqaalaat al-Mutanawwi’ah – Volume 4, Page 194
Question: After having joined the first row of the [congregational] prayer, someone broke wind and continued with his prayer as he did not wish to disturb any of the people in the rows behind him nor ruin their concentration. What is the ruling regarding this?
Response: We plead with Allaah that He forgives him. That which is obligatory upon the person who has either broken wind whilst in prayer or remembered that he is not in a state of wudhoo is that he breaks his prayer and goes and makes wudhoo and then he returns to re-join whatever remains of the [congregational] prayer.
As for the rows of people performing the congregational prayer, then the sutrah of the imaam suffices all of them. So, there is no harm if he were to pass in front of the people. It is obligatory upon him to depart calmly and peacefully so as not to disturb those who are [still] praying.