[The seventh century apocalypse Sefer Zerubbabel] describes the eschatological struggle between Armilos, the leader of Rome and of Christianity, and the Messiah ben Joseph, who falls in battle but prepares the way for the Davidic Messiah.
I first learned about the Messiah ben Joseph when I read Hal Lindsey's The Late Great Planet Earth. It was during a Feast of Tabernacles in the late 1980's, and my family was in Florida. We were heading to Medieval Times, a restaurant in which we played dukes and duchesses and watched knights fight each other (our guy lost). I was reading Hal Lindsey in the back of the van, and he had a chapter on the fulfillment of prophecy.
Hal Lindsey said that the Old Testament predicted a Messiah who would suffer and die, yet defeat evil and reign. He remarked that even Jews see these two portrayals of the Messiah in their own Bible, but, unlike Christians, they don't conclude that a single Messiah will die, rise again, and return in the future to destroy the wicked. Rather, they hold that there will be two separate Messiahs: one who will suffer and die, and another who will defeat Israel's enemies and rule the world.
Hal Lindsey did not use the terms "Messiah ben Joseph" and "Messiah ben David." I may have encountered those terms at various points in my reading, but the first time I understood the "Messiah ben Joseph" concept was when I was at Harvard. I read a book for Harvey Cox's "Contemporary Images of Jesus" class, entitled Jesus through Jewish Eyes. One of the chapters argued that Jesus could have been a Messiah ben Joseph, a figure who would do good for Israel yet come to a terrible end. According to the chapter, Jesus was not the Messiah ben David, since the Messiah ben David will bring peace to the earth, something Jesus did not do. But he may have been a Messiah son of Joseph. And, for this chapter, Jewish tradition believed there could be more than one Messiah ben Joseph before the coming of the Davidic Messiah.
Messianic Jews and Jews for Jesus lean heavily on the "Messiah ben Joseph" concept in rabbinic literature, perhaps because it shows that Judaism believed in a suffering Messiah. That would (a.) assure reluctant Jews that believing in Jesus does not contradict their Jewish heritage, since Judaism itself had a concept of a suffering Messiah, and (b.) show that the suffering Messiah is in the Hebrew Bible, which is why even anti-Christian or non-Christian Jews had to do something with that motif. But Christianity is the religion that fulfills it, Christians argue, since Jesus came, did Messianic things like heal and raise the dead, died for our sins, and rose.
One Messianic congregation I know of claims that Jesus was the Messiah ben Joseph whom the sages talk about. I've often wondered what it means by this. For one, I doubt that the rabbis believed in Jesus. And, second, Jesus wasn't from the tribe of Ephraim, which is what "ben Joseph" means. I think that some Messianic Jews think "ben Joseph" means the son of a man named Joseph, which Jesus was (according to Matthew and Luke), rather than a tribe in Northern Israel. Consequently, they get a lot of nods from people when they speak of the rabbis foretelling a Messiah son of Joseph, who would die for the sins of Israel. "Of course that's Jesus," people in the congregation are thinking. "He was the son of Joseph, and he died for our sins." They don't consider that "son of Joseph" may not mean what they think it means, nor do they consider the unlikelihood that the rabbis believed in Jesus, since rabbinic Judaism and Christianity were at odds.
I found the Jewish Encyclopedia's description of the Messiah ben Joseph to be interesting:
Finally, there must be mentioned a Messianic figure peculiar to the rabbinical apocalyptic literature—that of Messiah ben Joseph. The earliest mention of him is in Suk. 52a, b, where three statements occur in regard to him, for the first of which R. Dosa (c. 250) is given as authority... In the last of these statements only his name is mentioned, but the first two speak of the fate which he is to meet, namely, to fall in battle (as if alluding to a well-known tradition). Details about him are not found until much later, but he has an established place in the apocalypses of later centuries and in the midrash literature—in Saadia's description of the future ("Emunot we-De'ot," ch. viii.) and in that of Hai Gaon ("Ṭa'am Zeḳenim," p. 59). According to these, Messiah b. Joseph will appear prior to the coming of Messiah b. David; he will gather the children of Israel around him, march to Jerusalem, and there, after overcoming the hostile powers, reestablish the Temple-worship and set up his own dominion. Thereupon, Armilius, according to one group of sources, or Gog and Magog, according to the other, will appear with their hosts before Jerusalem, wage war against Messiah b. Joseph, and slay him. His corpse, according to one group, will lie unburied in the streets of Jerusalem; according to the other, it will be hidden by the angels with the bodies of the Patriarchs, until Messiah b. David comes and resurrects him...
Two details stand out to me:
1. The Messiah son of Joseph will rebuild the temple. In the New Testament, a "temple of God" is prophesied for the end times. II Thessalonians 2:4 states that the man of sin will sit in the temple of God, proclaiming himself to be God. Revelation 11:1-3 says that God will give the outer court of the temple to the Gentiles, who will trample the city for forty-two months, during which time the two witnesses will prophesy wearing sackcloth.
Those who believe that Revelation was fulfilled in the first century with the Roman destruction of Jerusalem will interpret these passages in a certain way. But people who think Revelation predicts the future will have a question: Where will the temple of God come from, considering that it is not standing today?
Many believe that the Jews will rebuild it, or that the Antichrist will negotiate a deal between Jews and Muslims so that the Jews can build a temple in its traditional site, where the Dome of the Rock now stands. But here is a problem: the New Testament calls the temple the "temple of God," meaning that God recognizes it. Would God recognize a temple that the Antichrist built? That's why some believe that a person God designates will be the one who will rebuild the temple. According to my dad, the two witnesses will be the ones who will perform this task.
But it's interesting to see how a strand of Jewish eschatology addresses this issue: the Messiah ben Joseph will rebuild the temple. This brings me to my second point:
2. Could the two witnesses be Messiah ben Joseph? We don't know how early the Messiah ben Joseph legend is. Could it go back at least to the time in which the Book of Revelation was written? There are parallels between Messiah ben Joseph and the two witnesses of Revelation: both have temporary success against the powers of evil, both confront and are killed by an "Antichrist" sort of figure, and both lie unburied in the streets of Jerusalem, until they are raised. Moreover, Zechariah 4:14, which Revelation 11:4 partially cites, refers to the two witnesses as "the sons of fresh oil," implying anointing. And what does "messiah" mean? "Anointed."
It's something to think about.