The Messenger of Allah ﷺ said, "Does the one who raises his head from prostration before the imam not fear that Allah may transform his face into the face of a donkey?"
حدثنا إسماعيل عن يونس بن عبيد عن محمد بن زياد
قال رسول الله ﷺ ما يأمن الذي يرفع رأسه في صلاته قبل الإمام أن يحول الله صورته صورة حمار
Its chain of transmission is sahih. Bukhari related it, 1/177, in the Book of adhan, chapter on the sin of raising one's head before the imam, and Muslim, 1/321, no. 427, in the Book of prayer, chapter on the prohibition of preceding the imam, and Tirmidhi, 2/475, no. 582, and Tayalisi, 1/134, no. 260, Minhah, and Abdul-Razzaq, 2/373, no. 3751, in the Book of prayer, chapter on one who differs from the imam.