The Prophet Elijah
The Messianic redemption is closely associated with the name of the prophet Elijah. He is regarded as the forerunner of Moshiach, “the harbinger who will proclaim peace, the harbinger of good who will proclaim salvation, saying to Zion ‘Your G‑d reigns!’ ” (Isaiah 52:7)
Rambam writes: “Before the war of Gog and Magog a prophet will arise to rectify Israel and prepare their hearts, as it is said, ‘Behold, I am sending you the prophet Elijah [before the coming of the great and awesome day of G‑d]’ (Malachi 3:23).. Some of the sages say that Elijah will come before the coming of Moshiach.”
The apparent conflict of opinions is most readily resolved in terms of the tradition that Elijah will make two appearances: first he will appear with the coming of Moshiach; then he will be concealed to appear again before the war of Gog and Magog. The phrase “great and awesome day of G‑d” is thus read (a) as a reference to the day of Moshiach’s coming, stating that Elijah will come prior to this to announce and proclaim his coming; and (b) as a reference to the awesome day of the war of Gog and Magog and Elijah’s involvement with the resurrection of the dead.
The prophet Elijah’s functions will thus include: to rectify Israel’s behavior, causing them to return to G‑d with teshuvah, as a preparation for the Messianic redemption; to proclaim the imminent coming of Moshiach; to restore the sacred objects placed in the Holy of Holies of the first Bet Hamikdash, and later hidden by King Josiah before its destruction; and to be involved with the resurrection of the dead. Above all, the essential task of Elijah will be to resolve legal disputes and to establish peace in the world, as it is said, “He will turn the heart of the fathers to the children, and the heart of the children to their fathers.” (Malachi 3:24)
. See Pesikta Rabaty 36:4 (ed. Friedmann, ch. 35).
. A climactic battle (see Ezekiel ch. 38-39) in the early stages of the Messianic redemption (see Igeret Teyman, end of ch. 3) against the forces of evil. (In Tanchuma, Korach: end of 14, there seems to be an allusion that it may involve all the nations of the world.) These forces presumptuously undertake to battle not only Israel but the Almighty Himself, as it were, and will suffer an appropriate defeat. Even so, for a while it will be a most traumatic event with great trials and tribulations for Israel. See Agadat Bereishit 2:1; Midrash Tehilim 2:4; and the parallel passages cited there. See also Targum Yehonathan (and Targum Yerushalmi) on Numbers 11:26; and Torah Shelemah on this verse, note 196. See, though, below, Appendix II, note 17.
. Hilchot Melachim 12:2
. Seder Olam Rabba, ch. 17. Yalkut Shimoni, Melachim:par. 207. Cf. Radal on Pirkei deR. Eliezer, ch. 43, note 85. For another approach and resolution, see Chidushim Ubi’urim Behilchot Melachim, sect. IV.
. Eruvin 43b; Pesikta Rabaty 36:4.
. Berayta deR. Pinchas ben Yair, appended at end of Sotah; Yerushalmi, Shabbat 1:3. See Ran on Avodah Zara 20b, s.v. Biyerushalmi.
. Pirkei deR. Eliezer, end of ch. 43. Cf. Rambam’s commentary on Eduyot 8:7.
. Note, though, that even according to the sources cited above note 5, this need not be, and Moshiach may come even without any prior announcement by Elijah; see Otzar Balum on Ayn Ya’akov, Sanhedrin 98a; Responsa Chatam Sofer, vol. VI:no. 98; and Keren Orah on Nazir 66a. Cf. Chidushim Ubi’urim Behilchot Melachim, III:17, and IV:9; and the sources cited there.
. Yoma 52b; Horayot 12a.
. Mechilta, Beshalach, Vayasa:ch. 5.
. See above, note 6.
. Eduyot 8:7; Hilchot Melachim 12:2. Cf. Encyclopedia Talmudit, s.v. Eliyahu.