We have already discussed the ruling on standing up for one who comes in, in question no. 34497. This ruling includes students standing up for the teacher.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allaah have mercy on him) said:
I have heard that many teachers tell the students to stand up for them when they enter the classroom. Undoubtedly this goes against the saheeh Sunnah.
It was proven that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Whoever likes the people to stand up for him, let him take his place in Hell.” Narrated by Imam Ahmad, Abu Dawood and al-Tirmidhi from Mu’aawiyah (may Allaah be pleased with him) with a saheeh isnaad. Imam Ahmad and al-Tirmidhi also narrated with a saheeh isnaad from Anas (may Allaah be pleased with him): “No person was dearer to them than the Prophet (peace and blessings of Allaah be upon him), but when they saw him they did not stand up for him because they knew that he disliked that.”
So the Sunnah is not to stand up for teachers when they enter classrooms, in accordance with these two hadeeth and other similar reports.
It is not permissible for the teacher to tell them to stand up for him, because of the warning mentioned concerning that in the hadeeth of Mu’aawiyah, and it is makrooh for the students to stand up, because of the hadeeth of Anas quoted above. It is well known that all goodness is to be found in following the Sunnah of the Messenger of Allaah (peace and blessings of Allaah be upon him) and following his example and that of his companions (may Allaah be pleased with them). May Allaah make us and you among those who follow him in truth and help us to understand His religion and adhere steadfastly to it.
Majallat al-Buhooth al-Islamiyyah, 26/347.