Assalamualaikum ustaz. I was late in following the imam in the Subuh congregational prayer. After the tahiyat, the imam prostrated to perform the sahwi prostration. Is it obligatory for me to follow the imam and perform the sahwi prostration or stand up to add my rakaat?
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions and all those who follow his footsteps until the Last Day.
Sahwi prostration is the prostration performed due to deformity or deficiency of the prayer performed by a person when he was praying whether it is intentionally or because he forgets. It is performed at the end of the prayer before salam by prostrating twice just like other prostrations in prayer with the intention of performing sahwi prostration. 
In the above issue, it is permissible to follow the sahwi prostration with the intention of the makmum following the imam. An imam should be followed. In a hadith narrated from Abu Hurairah RA, the Prophet PBUH said:
إِنَّمَا جُعِلَ الْإِمَامُ لِيُؤْتَمَّ بِهِ
“The imam is appointed only to be followed,” 
Our teacher, al-Syeikh ‘Atiyyah Salim said: In the issue of sahwi prostration, when an imam prostrates and the makmum prostrates with him, all the while the imam prostrates because he had forgotten something when the makmum didn’t forget, they should also prostrate with the imam. 
In answering this issue, we present the hadith narrated from Umar RA, from the Prophet PBUH, the Prophet PBUH said:
لَيْسَ عَلَى مَنْ خَلْفَ الإِمَامِ سَهْوٌ فَإِنْ سَهَا الإِمَامُ فَعَلَيْهِ وَعَلَى مَنْ خَلْفَهُ
“There is no (prostrations of) forgetfulness for one who is led (in prayer) by an Imam, but when the Imam forgets, both should then make prostrations due to forgetfulness.” 
These hadith become the evidence that the imam bears the forgetfulness of the makmum. If the makmum forgets, while the imam didn’t forget, then the makmum doesn’t need to perform sahwi prostration. This is as stated by Ibn Munzir through ijma’. The usul of shariah supported this. The reason is the makmum has to follow the imam until mutaba’ah (following is prioritized over the initial tasyahhud). 
This hadith also shows that if the makmum didn’t forget but the imam forgets while the makmum only had the chance to follow the imam in the final tasyahhud, then he should prostrate together with the imam and during the sahwi prostration, he should recite:
وَإِذَا سَجَدَ فَاسْجُدُوا
“And when he prostrates, you should prostrate.” 
Ibn Munzir stated it through ijma’.
Sometimes, the makmum didn’t make a mistake while the imam is mistaken. For example, the imam forgot to recite the qunut while the makmum didn’t forget and recited a very brief qunut. Afterwards, at the end of the prayer, the imam performs the sahwi prostration because he forgot to recite qunut, then the makmum should prostrate together with the imam. This is not an issue and the makmum doesn’t have to forget as the imam did to perform the sahwi prostration.
Let us together supplicate the following:
رَبَّنَا لَا تُؤَاخِذْنَا إِن نَّسِينَا أَوْ أَخْطَأْنَا ۚ رَبَّنَا وَلَا تَحْمِلْ عَلَيْنَا إِصْرًا كَمَا حَمَلْتَهُ عَلَى الَّذِينَ مِن قَبْلِنَا ۚ رَبَّنَا وَلَا تُحَمِّلْنَا مَا لَا طَاقَةَ لَنَا بِهِ ۖ وَاعْفُ عَنَّا وَاغْفِرْ لَنَا وَارْحَمْنَا ۚ أَنتَ مَوْلَانَا فَانصُرْنَا عَلَى الْقَوْمِ الْكَافِرِينَ
“Our Lord! Punish us not if we forget or fall into error. Our Lord! Lay not on us a burden like that which You did lay on those before us. Our Lord! Put not on us a burden greater than we have the strength to bear. Pardon us and grant us forgiveness. Have mercy on us. You are our Protector, and help us against the disbelieving people.”
 Narrated by al-Baihaqi (2/532) and al-Daraqutni (1/377). As stated by al-Baihaqi this hadith is dha’if. Al-Syaukani said, one of the narrators in the sanad is Kharijah bin Mus’ab, while he is dha’if. The same for Abu al-Husin al-Madini where he is majhul.