All perfect praise be to Allah The Lord of The Worlds, and may His peace and blessings be upon our Prophet Muhammad and upon all of his family and companions.
What the Imam did, as mentioned above, is valid and considered an act of Sunnah according to jurists, because the prayer is considered valid only after the first Tsleem(to say the salutation: “As-salamu `alaykumwaraḥmatullah” to the right and the left. Therefore, it is reprehensible to turn one`s face to the left or right before reciting"As-salamu 'alaykum".
In addition, it was stated in the Shafie book [Bushra Al-Kareem Sharih Al-Mokadema Al-Hadramiah]:" A praying person should not turn his/her face before reciting As-salamu 'alaykum as an act of Sunnah since doing otherwise is reprehensible." And Allah knows best.