We set out and came to the Prophet ﷺ, where we pledged allegiance to him and prayed behind him. Then we prayed another prayer behind him, and when he finished the prayer, he saw a man praying alone behind the row.The Prophet of Allah ﷺ stood over him when he had finished and said, "Repeat your prayer. There is no prayer for the one who prays behind the row alone."
خرجنا حتى قدمنا على النبي ﷺ فبايعناه، وصلينا خلفه، ثم صلينا وراءه صلاة أخرى، فقضى الصلاة. فرأى رجلا فردا يصلي خلف الصف قال: فوقف عليه نبي الله ﷺ الحين انصرف فقال: استقبل صلاتك، ولا صلاة للذي خلف الصف.
Ibn Majah (1003) narrated it from Abu Bakr bin Abu Shayba, who said, Mulazim bin Amr told us, from Abdullah bin Badr, who said, Abdul-Rahman bin Ali bin Shayban told me, from his father Ali bin Shayban, and he mentioned it. It is also in Musannaf Ibn Abu Shayba (2/193). Busiri said, "Its isnad is sahih and its narrators are trustworthy." Ibn Khuzayma (1569) and Ibn Hibban (2202) graded it sahih, both narrating it through the route of Mulazim bin Amr in the same way. Imam Ahmad (16297) narrated it from Abdul-Samad and Siraj, who both said, Mulazim bin Amr told us it, except that he combined the two hadiths.This is the hadith of the chapter, and there is another hadith, which is that the Prophet ﷺ saw a man praying without straightening his back in ruku and sujud, so he said, "O company of Muslims, there is no prayer for one who does not straighten his back in ruku and sujud." This latter hadith is mentioned in the chapter on moderation in ruku and sujud. Ali bin Shayban, during his journey, prayed several prayers behind the Messenger of Allah ﷺ. On one occasion he narrated the first story, and on another he narrated the second story, and perhaps on yet another occasion he combined the two stories. This isnad was graded sahih by Ibn Khuzayma (593), who narrated only the second story through the route of Mulazim bin Amr.Tirmidhi said, "Some scholars disliked that a man should pray behind the row alone, and they said he must repeat the prayer if he prays behind the row alone. This is the view of Ahmad, Ishaq, and a group of the scholars of Kufa. Other scholars said it suffices for him if he prays behind the row alone, and this is the view of Sufyan Thawri, Ibn Mubarak, and Shafii." End of quote.The correct conclusion on this matter is that one who prays behind the row alone because there is no space available in the row before him, his prayer is valid. As for the view of those who say that he should pull someone from the row in front of him to stand with him, all the hadiths on this matter are daif, as already shown. Moreover, this practice conflicts with the consistent practice of congregational prayer in the front rows, and it may cause friction and mutual resentment between the two people, and it goes against the etiquette of prayer.