This view is undoubtedly incorrect. It is not permissible for anyone to attribute to Islam something that is not part of it. Allaah has forbidden us to speak of Him without knowledge, as He says (interpretation of the meaning):
“Say (O Muhammad): (But) the things that my Lord has indeed forbidden are Al‑Fawaahish (great evil sins and every kind of unlawful sexual intercourse) whether committed openly or secretly, sins (of all kinds), unrighteous oppression, joining partners (in worship) with Allaah for which He has given no authority, and saying things about Allaah of which you have no knowledge”
Whoever stands with the imam until he has completed the prayer, it is equivalent to spending the whole night in prayer.
It was narrated that Abu Dharr (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Whoever stands with the imaam until he finishes, it is equivalent to spending the whole night in prayer.”
Narrated by al-Tirmidhi, 806; Abu Dawood, 1375; al-Nasaa’i, 1605; Ibn Maajah, 1327. Classed as saheeh by al-Tirmidhi, Ibn Khuzaymah (3/337), Ibn Hibbaan (3/340) and al-Albaani in Irwa’ al-Ghaleel, 447.
This reward (the reward of spending the whole night in prayer) is not attained by anyone except the one who stands with the imam for the whole prayer, until he completes it, as the Prophet (peace and blessings of Allaah be upon him) said.
As for the one who prays as much as he can and then leaves before the imam has completed his prayer, only what he has prayed will be recorded for him, but it will not be recorded as if he spent the entire night in prayer. Allaah says (interpretation of the meaning):
“So whosoever does good equal to the weight of an atom (or a small ant) shall see it.
8. And whosoever does evil equal to the weight of an atom (or a small ant) shall see it”
Perhaps your imam wanted to say that but he expressed it incorrectly, or perhaps you did not really understand what he meant.
And Allaah knows best.