Islam lays great importance to prayer as it is the second pillar of Islam. Many traditions of the Prophet (Peace and Blessings be upon him) encourage us to perform it in the mosque. Allah the Almighty says: (and establish regular Prayer: for Prayer restrains from shameful and unjust deeds; and remembrance of Allah is the greatest (thing in life) without doubt. And Allah knows the (deeds) that ye do) ( Al-‘Ankabut 29:43)
Other traditions warn Muslims against divisions and one of the division sorts is to pray alone behind the Imam although there is a place among the lines where you could join and there is no reason not to join the line. Praying alone behind the imam with the possibility to join the line is generally v alid but according to some schools of law say it is disapproved but it is sound.
The majority of scholars including the Shafi’i and Hanafi schools of law view that praying alone behind the imam with reason is valid but is disapproved but it is OK if there was a reason for that such as feeling unwell or there is no place among the rows, etc. The Maliki school say that the one who prays alone weather there was a reason or not, his prayer is valid. To support their viewpoint they refer to there Hadith where the Prophet (peace and Blessings be upon him) said to one of the companion who rushed to join the congregation prayer without joining the row: “May Allah increase your awareness but do not repeat that again”. (Reported by Al-Bukhari)
Generally speaking we recommend to stick to the row as the main purpose behind of congregation prayer is that Muslims should stand in the rows as one man and there would be no division among them.