What is the ruling on standing when the national anthem is played, or when the flag is saluted?.
Playing or listening to national anthems is haraam. This has been discussed in the answer to question no. 5000 and 20406. It makes no difference whether what is played is songs or the national anthem or anything else.
Standing by way of humility and veneration is not befitting unless it is done for Allaah.
Allaah says (interpretation of the meaning):
“And stand before Allaah with obedience”
Allaah has said that because of His greatness and majesty, the greatest of creation (the angels) will stand for Him on the Day of Resurrection and no one will speak until after Allaah has given him permission. He says (interpretation of the meaning):
“The Day that Ar‑Rooh [Jibreel (Gabriel) or another angel] and the angels will stand forth in rows, they will not speak except him whom the Most Gracious (Allaah) allows, and he will speak what is right”
The one who claims that there is any created being for whom one should stand out of respect have given that created being one of the rights of Allaah.
Hence the Prophet (peace and blessings of Allaah be upon him) said: “Whoever likes men to stand up for him, let him take his place in Hell.” Narrated by al-Tirmidhi (2755); classed as saheeh by al-Albaani in Saheeh al-Tirmidhi. That is because this is part of the might and pride that belongs only to Allaah.
See: Tafseer al-Tahreer wa’l-Tanweer by al-Taahir ibn ‘Ashoor (15/51).
The caliph al-Mahdi entered the Mosque of the Messenger of Allaah (peace and blessings of Allaah be upon him) and the people all stood up for him except Imam Ibn Abi Dhi’b. It was said to him: Stand up; this is the Ameer al-Mu’mineen. He said: The people should only stand up for the Lord of the Worlds.
Al-Mahdi said: Let him be, for all the hairs of my head have stood on end.
Siyar A’laam al-Nubala’ (7/144).
The scholars of the Standing Committee were asked: Is it permissible to stand to show respect to any national anthem or flag?
It is not permissible for the Muslim to stand out of respect for any national anthem or flag, rather this is a reprehensible innovation which was not known at the time of the Messenger of Allaah (peace and blessings of Allaah be upon him) or at the time of the Rightly-Guided Caliphs (may Allaah be pleased with them), and it is contrary to perfect Tawheed and sincere veneration of Allaah alone. It is also a means that leads to shirk and is an imitation of the kuffaar in their reprehensible customs, and following them in their exaggeration about their presidents and in their ceremonies. The Prophet (peace and blessings of Allaah be upon him) forbade imitating them.
And Allaah is the Source of strength; may Allaah send blessings and peace upon our Prophet Muhammad and his family and companions. End quote.
Fataawa al-Lajnah al-Daa’imah (1/235).
And Allaah knows best.