All perfect praise be to Allah, the Lord of the Worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
The prostration is one of the pillars of prayer that is not remedied by sujood as-sahw (the two prostrations of forgetfulness) if it was left unintentionally. If it was left intentionally, then the prayer becomes invalidated the moment it is omitted.
Therefore, if the imam forgot the prostration, then it was the duty of the one being led to alert him. If he was not alerted, then the one being led must perform the prostration and his prayer is valid. If he followed him in omitting the prostration, then his prayer is invalid.
If the Imam did not remember that he forgot the prostration until after a long period had passed, like after the people dispersed and exited the Masjid, then his prayer is invalid and he must repeat it.
Allah knows best.