It may be thrown away, but not in a disrespectful manner (In the book Nefesh Ha-Rav pp. 99-100, it is related that one year the Agudat Yisrael Conference was held in a hotel in Yerushalayim and there was an Israeli flag flying on the roof.
Some of the participants, who were opposed to the State of Israel, were unhappy about this, but instead of requesting that the flag be removed they asked if all of the flags of the participants’ countries be flown as well. After this was publicized, Ha-Rav Yosef Soloveitchik stated at the Mizrachi Conference that while the Jewish People had flags in the desert, they were temporary and not for all generations. But the flag of Israel has a different significance.
There is a Minhag in the name of the Rishonim brought in the Shulchan Aruch, Yoreh Deah 366:4: “If a Jew is found murdered, he is to be buried as he was found [i.e. in his bloody clothes] without any shrouds.” The Shach #11 explains that the reason for this Minhag: to kindle Hashem’s wrath when He sees how this person was buried without shrouds.
Hashem’s compassion will thus be aroused to avenge him. And the same applies to the Israeli flag. Towards the end of the War of Independence, the UN set a specific time by which the Jews and Arabs could seize land. They established that all the territory in the hands of the Jews, as signified by raising the Israeli flag on that spot, would become part of the State of Israel, and all territory in Arab hands, would remain outside the State of Israel. And this is indeed what occurred.
During this period, much Jewish blood was spilled in order to raise the Israeli flag over as much territory as possible. Many Jewish fighters were killed, displaying self-sacrifice for the sole purpose of raising the Jewish flag, the flag of Israel. Therefore, Rav Soloveitchik said, the flag of the State of Israel has the status of a murdered Jew’s clothing, a symbol of the spilled blood of the Jews. As a result, when the flag of Israel flies, it arouses Hashem’s compassion for Am Yisrael).