Reference: al-Muntaqaa min Fataawa Shaykh Saalih al-Fowzaan – Volume 5, Page 50, Fatwa No.75
Question: I went to the masjid and found the congregational prayer had finished and found someone praying by himself; Is it permissible for me to stand beside him and pray [along with him] on the basis that this person is the imaam and I am following [him]?
Response: Yes, it is permissible based upon the correct [opinion] of the two opinions of the scholars; If you find a person praying on his own and you have missed the congregational prayer, then there is no harm in you joining with him and [thereby] you both pray in congregation, since the congregational prayer is obligatory as much as one is able. The evidence for this is that the Prophet ﷺ stood for the night prayer and then Ibn ‘Abbaas (radhi-yAllaahu ‘anhumaa) entered and joined him in the prayer, so he stood to the left of him and the Prophet ﷺ moved him around to the right of him, [and this was] whilst the Prophet ﷺ had [already] begun the prayer on his own and Ibn ‘Abbaas [later] joined him and he (the Prophet) acknowledged this [Saheeh Muslim (1/525/526) from the hadeeth of Ibn ‘Abbaas (radhi-yAllaahu ‘anhumaa)]. So that which is permissible in the voluntary [prayers] is permissible in the obligatory [prayers] unless there is evidence to indicate otherwise.