All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
The most preponderant opinion and the Fatwa that we adopt here in Islamweb is that a person led in the prayer is obliged to follow the Imaam and he should bow down for Ruku’ with him even if he did not finish the recitation of Al-Faatihah. However, the Shaafi’i School of jurisprudence, has two opinions in regard to the person led in the prayer if he did not finish the recitation of Al-Faatihah. The first opinion is that he should follow the Imaam and not complete the recitation of Al-Faatihah, and the second opinion – which is their most correct opinion – is that he should complete the recitation of Al-Faatihah, and when he finishes the recitation of Al-Faatihah he continues the sequence of the prayer unless the Imaam precedes him with more than three pillars of the prayer, in which case, he should follow the Imaam in the pillar which the Imaam is performing – according to their most correct opinion – and he should not follow the sequence of his prayer and then he would pray whatever (Rak’ahs) he missed with the Imaam on his own after the Imaam concludes the prayer with Salaam. Therefore, what you did is correct according to the Shaafi’i School of jurisprudence.