All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
It is better for the Muslim to come to the Masjid in quietness, tranquility and solemnity. He should not start his prayer until he takes his place in the row then says Takbeerat Al-Ihraam (the commencement Takbeer). If he says Takbeerat Al-Ihraam before he reaches the row and takes his place therein then he immediately joins the row, his prayer is valid but he did not abide by the better option. According to Al-Musnad and Saheeh Al-Bukhari, Abu Bakrah reached the Masjid while the Prophet, sallallaahu ‘alayhi wa sallam, was bowing; so he bowed before reaching the row. He mentioned this to the Prophet, sallallaahu ‘alayhi wa sallam, so he said: "May Allaah increase your keenness. But do not repeat it again (bowing in that way).”
Allaah Knows best.