How to Follow the Imam in Prayer
Question

We see some people delaying following the imam in prayer, and some others anticipating him in sujud [prostration] or ruku` [bowing] sometimes. 
We hope that you could explain to us the ruling on anticipating the imam or delaying following him, so that Allah may benefit us thereby.
Praise be to Allah.Shaykh Muhammad ibn ‘Uthaymin (may Allah have mercy on him) said in al-Sharh al-Mumti’: 
Scenarios of praying behind an imam
“When a person prays behind an imam, four scenarios may apply: 

Anticipation (doing a movement before the imam) 
Delay in following the imam
Doing an action simultaneously with the imam 
Following (doing a movement immediately after the imam)

Doing a movement before the imam 
This refers to the person doing one of the essential parts of prayer before the imam, such as prostrating or rising before the imam, or bowing or rising from bowing before him. This is haram, and the evidence for that is the hadith of the Prophet (peace and blessings of Allah be upon him): “Do not bow until he bows , do not prostrate until he prostrates.” The basic principle is that the words “do not” indicate that the action is haram, and if someone were to say that it is a major sin, that would not be far fetched, because the Prophet (peace and blessings of Allah be upon him) said: “Does the one who raises his head before the imam not fear that Allah may turn his head into the head of a donkey, or make his form like that of a donkey?” This is a warning, and a warning is one of the signs that a sin is a major sin. 
Ruling on the prayer of one who anticipates the imam 
If a person anticipates the imam knowingly, aware of the ruling and of what he is doing, then his prayer is invalid. But if he is ignorant or forgot, then his prayer is valid, unless that excuse ceased to exist before the imam did that action, in which case he has to go back and repeat what he did before the imam, after the imam. If he does not do that, knowing the ruling and being aware of what he is doing, then his prayer is invalid, otherwise it is not.  
Delaying in following the imam 
There are two kinds of delay in following the imam: 

Delay for a reason
Delay without any excuse


The first kind is where there is a reason or excuse. He has to make up what he delayed, then he should follow the imam, and there will be no blame on him, even if it is one or two essential parts of the prayer. 

So if a person is distracted or loses focus, or did not hear the imam until the imam has done one or two essential parts of the prayer before him, then he should do the things that he delayed in and then follow the imam, unless the imam reaches the point where he is [in the rak`ah], in which case he should not make up the missing parts and he should stay with the imam. Then one rak`ah will be valid for him which is formed from two rak`ahs of the imam, the rak`ah in which he delayed and the rak`ah which the imam reached the same point as him.
An example of that is that a man was praying with the imam and the imam bowed, rose, prostrated, sat up, prostrated a second time and stood up, but the person praying behind him did not hear the loudspeaker except in the second rak`ah, because the electricity cut out for example. 
Let us assume that this was during Jumu`ah prayer, so he heard the imam reciting al-Fatihah , then the electricity cut out, and the imam completed the first rak`ah, but the person remained standing thinking that the imam had not yet bowed in the first rak`ah, then he heard him reciting “Has there come to you the narration of the overwhelming (i.e. the Day of Resurrection)?” [Al-Ghashiyah 88:1 – interpretation of the meaning] 
We say: you should stay with the imam, so the second rak`ah for the imam will be the rest of the first rak`ah for you. Then when the imam says the taslim, you should make up the second rak`ah. The scholars said: so the person praying behind the imam will have one rak`ah that is formed from the two rak`ahs of his imam, because followed the imam in part of the first and part of the second.  
If he realizes that he has lagged behind before the imam reaches the same point [in the second rak`ah], he should make it up and follow the imam. For example, a man is standing with the imam, and the imam bows but he does not hear that he is bowing. When the imam says “Sami’a Allahu liman hamidah [Allah hears those who praise Him – said when rising from bowing], when the person praying behind him hears that, we say to him: Bow and rise, and follow your imam, and you will have caught up with the rak`ah, because the delay here was for a reason. 

The second type is delaying with no excuse. 

Delaying with regard to an essential part of the prayer means lagging behind in following the imam, but catching up with him in the next essential part of the prayer. For example, the imam bows when you still have a verse or two left of the surah you are reciting, so you remain standing to complete what you still have to recite, but then you bow and catch up with the imam in ruku`. In this case the rak`ah is valid, but your action goes against the Sunnah, because what is prescribed is to start bowing when the imam reaches the bowing posture and not to lag behind, because the Prophet (peace and blessings of Allah be upon him) said: “When he bows, then bow.” 
Lagging behind in an essential part of the prayer means that the imam is one step ahead of you in the prayer, i.e., he bows and rises before you bow. The jurists (may Allah have mercy on them) said: if you lag behind in ruku` then your prayer is invalid, just as if you did ruku` before the imam. If you lag behind in sujud (prostration) then according to what the jurists say your prayer is valid, because it is lagging behind in an essential part of the prayer other than ruku`. 
But the correct view is that if a person lags behind the imam in any essential part of the prayer with no excuse, then his prayer is invalid, whether that is in ruku` or any other part of the prayer. Based on this, if the imam rises from the first prostration and this person who is praying behind him is making du`a in sujud and continues to make du`a until the imam prostrates for the second time, then his prayer is invalid, because he has lagged behind in an essential part of the prayer. If the imam is one step ahead of him, how can he then be following him? 
Doing an action simultaneously with the imam 
This refers either to word or actions, and falls into two categories: 

The first category is to say words simultaneously. This does not matter, except in the case of the takbirat al-ihram (saying “Allahu akbar” to start the prayer) and the salam (at the end of the prayer). 

With regard to the first takbir, if you say takbir before the imam has completed his takbirat al-ihram, you have not entered prayer in the first place, because it is essential to say the takbirat al-ihram after the imam has finished saying it completely. 
With regard to the salam, the scholars said that it is makruh to say the first and second salam at the same time as your imam, but if you say the first salam after he has said the first salam and the second salam after he has said the second salam, there is nothing wrong with this, but it is better not to say the salam until the imam has said both. 
With regard to all other words of the prayer, it does not matter if you say them simultaneously with the imam, or before him, or after him. If we assume that you hear the imam reciting the tashahhud, and you have already recited it, this does not matter, because anticipating the imam in the words of prayer, apart from the first takbir and the salam, does not affect the prayer. Similarly it does not matter if you recite al-Fatihah before him and say Wa la’l-dallin “nor of those who went astray” [Al-Fatihah 1:7 – interpretation of the meaning], whilst he is still reciting Iyyaka na’abudu wa iyyaka nasta’in “You (Alone) we worship, and You (Alone) we ask for help (for each and everything)” [Al-Fatihah 1:5 – interpretation of the meaning], in Zuhr prayer, for example, because it is prescribed in Zuhr and  ‘Asr prayer for the imam to let the people hear the verse he is reciting sometimes, as the Messenger of Allah (peace and blessings of Allah be upon him) used to do. 

The second category is to do the actions of prayer simultaneously with the imam, and this is makruh. 

For example, when the imam says “Allahu akbar” for ruku`, and starts to bend forward, and you start to bow simultaneously with the imam, this is makruh, because the Messenger (peace and blessings of Allah be upon him) said, “When he bows, then bow, and do not bow until he bows.” And in sujud when he says takbir for sujud, if you prostrate and reach the floor at the same time as him, this is makruh, because the Messenger (peace and blessings of Allah be upon him) disallowed that and said, “Do not prostrate until he prostrates.” 
Doing a movement immediately after the imam 
Following is the Sunnah, and what it means is that a person starts to do the actions of prayer immediately after the imam starts them, but without doing them at the same time. 
For example, when he bows, you bow, even if you have not completed the recitation that is mustahabb [recommended, encouraged], and even if you have a verse still to go, because that would mean that you are lagging behind, so you do not complete it. 
In sujud, when the imam rises from his prostration, you follow the imam, and your following him is better than your remaining in prostration making du`a to Allah , because your prayer is connected to the imam, and you are now enjoined to follow your imam.” (Adapted from al-Sharh al-Mumti’, 4/275) 
The person who is praying behind an imam should not move to the next posture of the prayer until the imam has reached it, so he should not start to go down for prostration, until the imam has placed his forehead on the ground. 
Al-Bara ibn ‘Azib said: When the Prophet (peace and blessings of Allah be upon him) said, ‘Sami’a Allahu liman hamidah’, none of us would then bend our backs [to start prostrating] until the Prophet (peace and blessings of Allah be upon him) went down into prostration, then we would go down into prostration after him. Narrated by al-Bukhari, 690; Muslim, 474.
And Allah knows best.