بسم الله الرحمن الرحيم
On the authority of Abu Huraira,
The Messenger of Allah -sallahu alayhi wa salaam- said, “The Imam was made to be followed, so when he makes the takbir you make the takbir. When he bows you bow, and do not bow until he bows. When he says Allah hears whomever praises him, you all say O Allah our Lord to you belong all praise. When he prostrates you prostrate, and do not prostrate until he prostrates. If he prays standing then pray standing, and if he prays sitting then pray sitting.”
Shaykh Uthaymin stated the following while explaining this narration:
The condition of the one being led in prayer as it relates to being in accordance with the imam is of four (varying states). He either precedes him, moves simultaneously with him, lags behind him, or follows him. These are the four conditions. If he precedes him in saying the first takbir then he hasn’t entered into the prayer, due to him intending to pray in congregation (but by his preceding he does so) without an imam. As the imam has yet to pronounce the takbir in order for the one being led to have an imam.
So if he knows the imam has not yet made the takbir then he should cut his prayer, meaning he should intent to cut his prayer and make the takbir after the imam has done so. The scholars differ regarding its occurrence in other than the first takbir. Some say that the prayer is not invalid unless the imam is preceded by an entire pillar, otherwise it is not invalid if the precedence is to a pillar. Consequently it is binding upon you to know the difference between preceding to a pillar, and preceding by a pillar.
Preceding to a pillar is the one being led in prayer arriving at the next pillar (position of prayer) before the imam; however, the imam reaches him while in that position. For instance, if the follower pronounces the takbir in order to move to the bowing position (before the imam and does so) and the imam meets him while in that position before the follower rises to the next position. Whereas being preceded by a pillar is when the follower moves to the next position (before the imam), then he completes it and moves to the next -another- position -being 2 steps ahead- before the imam arrives at the initial pillar in which he was preceded. This is preceding him by a pillar.
Being preceded in a pillar does not invalidate the prayer based on that which is widespread in my school of jurisprudence; however, he must return to the previous position so that the imam precedes him and he follows after him. But what is correct (with the Sheikh) is that if the imam is preceded in a pillar deliberately then the prayer is invalid and the proof for this is the Prophet’s statement, “Do you not fear that if you were to raise your head before the imam that Allah will make your head like that of a donkey, or your shape like that of a donkey?” This threat denotes the action’s prohibition. If a person commits a prohibited act during worship (that is directly connected to the act of worship) then the act is invalid based on legislative principle, due to it being removed from the very manner in which it was performed. Indeed the Prophet -sallahu alayhi wa salaam- said, “Whoever does an action that is not in accordance with our command then it is rejected.”
Hence what is correct is that if a person precedes the imam in going to the next pillar deliberately, his prayer as a result is invalid. However if he is not deliberate like the one who hears a sound and he thinks the imam pronounced the takbir and due to that he bows, his prayer is not invalid and he is excused due to ignorance. Moreover once he realizes the imam has not bowed then he should return to the previous position until the imam bows and he does so after him. If the imam bows before he can return to the previous position then he remains where he is along with his imam and he is excused in this regard.
Source: شرح بلوغ المرام
Translated by Najeeb Al Anjelesi