When the prophets instituted the four fasts after the destruction of the FirstTemple, they modeled them after the fast of Yom Kippur, which is how the Rabbis usually enact decrees, modeling them after the Torah’s commandments. Since Yom Kippur lasts an entire day, [the prophets] instituted the four fasts [as full-day fasts], and since there are five prohibitions on Yom Kippur – eating and drinking, bathing, anointing, wearing [leather] shoes, and marital relations – they prohibited the same things on the fasts commemorating the churban. This is how [the Jews] observed these fasts throughout the seventy-year Babylonian exile.
When the exiles returned from Babylonia to build the Second Temple, these fasts were canceled and transformed into joyous days, as it says, Thus says the Lord of Hosts, “The fast of the fourth [month] (Tammuz), the fast of the fifth (the ninth of Av), the fast of the seventh (the third of Tishrei), and the fast of the tenth (the tenth of Tevet) will be to the House of Judah for joy and for gladness, and for festive days; love truth and peace” (Zecharyah 8:19).
And when the SecondTemple was destroyed, the Jews went back to observing the very same fasts, keeping them throughout the difficult years following the second churban, during which Bar Kochva’s rebellion and the destruction of Beitar and Judea took place. Thus, the status of these fasts depends on our national situation: at a time of evil decrees and persecution, we are obligated to fast, but when the Temple is standing these fasts become days of joy and gladness.
In the intermediate situation – when the Temple is destroyed, but we are not plagued with harsh decrees, as was the case during R. Yehudah HaNasi’s lifetime – the status of these fasts depends on the will of the Jewish people: “If they want to fast, they do so; if they do not want [to fast], they do not fast.” This is the law regarding the tenth of Tevet, the seventeenth of Tammuz, and Tzom Gedalyah. Regarding Tish’a B’Av, however, the matter does not depend on the nation’s will, and everyone is obligated to fast, even in the intermediate situation, because both Temples were destroyed on that day (Rosh HaShanah 18b).
In practice, the Jewish people are accustomed to observing all the fasts, even in the intermediate situation. Therefore all Jews are obligated to fast on these days. This is the halachah until the Beit HaMikdash is rebuilt, speedily in our days, when the fast days will become joyous festivals.
Rav Pappa said, “This is what [the verse] is saying: When there is peace, [these days] will be for joy and for gladness; when the kingdom [issues evil] decrees [against the Jews], [they are] fast days; when there are no governmental decrees, but [also] no peace – if [the Jews] want to fast, they do so, [and] if they do not want [to fast], they do not fast.” If so, Tish’a B’Av should be [treated] the same! Says Rav Pappa, “Tish’a B’Av is different, because troubles abounded on that day, as the master said, ‘On Tish’a B’Av, both Temples were destroyed, Beitar was captured, and the city [of Jerusalem] was ploughed over.’ ”
According to Rashi, the definition of “a time of peace” – when the fasts are canceled – is when the nations of the world have no dominion over the Jews. If so, it is possible that [Jews living] in the State of Israel are exempt from fasting. However, most Rishonim – the Ramban, the Tur, and others – hold that “a time of peace” means when the Beit HaMikdash is built. Therefore, even after the establishment of the State of Israel, our status is that of the intermediate situation, and we are obligated to fast, based on Jewish custom. The Rishonim also disagree on when exactly one is obligated to fast according to the law. The Ramban holds that it is when [the Gentiles enact] harsh decrees against the Jews; while Rashi, the Tur, and the Tashbetz claim that it is [specifically] when there is religious persecution (gezeirot shmad), meaning decrees that prevent us from fulfilling the Torah. Their dispute stems from variant readings of the Gemara in Rosh HaShanah 18b. (I wrote [above] simply that the fasts returned to their obligatory status after the second destruction. However, the Chatam Sofer, OC 157, writes that [the Jews] began fasting already before the churban, once the Sanhedrin went into exile, as is clear from Josephus. This shows that despite the existence of the HolyTemple, the status of the decrees is what determines the obligation to fast. Perhaps this supports Rashi’s opinion.)