The Ruling on praying while the Imam is on the Pulpit
Question :
If I entered the mosque on Friday while the Imam was delivering the Khutbah, is it permissible for me to pray two Rak'ahs?
Answer:
It is a Sunnah and highly recommended for the one who enters the mosque not to sit until he has offered two Rak'ahs as Tahiyyatul-Masjid, even if the Imam is delivering the Khutbah.
Source:
Ibn Jibreen
Fatawa Islamiyah, Vol. 2 Page 316