If you enter the mosque when the imam has stood up from bowing, then you should say the dhikr that is prescribed at this point, which is Rabbana wa laka’l-hamd, and you should not say the opening du’aa’, because its place is the beginning of the prayer, and you should not say A’oodhu Billaahi min al-shaytaan il-rajeem, because its place is before recitation.
Al-Bukhaari (689) and Muslim (411) narrated from Anas (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “The imam has been appointed to be followed, so when he says takbeer, then say takbeer; when he prostrates, then prostrate; when he rises, then rise, and when he says, Sami’a Allaahu liman hamidah, then say Rabbana wa laka’l-hamd. And if he prays sitting, then you should all pray sitting.”
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) was asked: If I join the imam when he is bowing, when I stand up for the second rak’ah should I recite the opening du’aa’ or not?
He (may Allaah have mercy on him) replied: If a person who joins the prayer late joins the imam when he is bowing, then he should say the opening takbeer first (takbeer al-ihraam) before bowing, then he should bow, but in this case if he says the takbeer for bowing it is better, but if he does not say it, it does not matter. This is the view of the scholars (may Allaah have mercy on them). Then when he gets up for the second rak’ah, he should not say the opening du’aa’ because the opening du’aa’ should only be said at the beginning of the prayer, and the beginning of the prayer has already passed. It is a Sunnah and he has missed its place, so he should not make it up at a point which is not the right place for it. But he should seek refuge with Allaah from the accursed shaytaan before reciting. End quote from Fataawa Noor ‘ala al-Darb.
To sum up: If a person catches up with the imam at some point, he should recite the dhikr that is prescribed at that point, such as if he catches up during the sitting between the two prostrations, he should say Rabb ighfir li, and if he catches up during the tashahhud he should recite it, and so on.
See also the answer to question no. 69821.
And Allaah knows best.