Some say that Zechariah 12:10 refers to the Gentile nations who mourn because of the Jewish martyrs (or a particular unknown martyr) they have killed.
Yet that is not the universal Jewish understanding. According to the views of some rabbis, two Messiahs would make their appearance: Messiah ben Joseph who would be slain in battle, followed by Messiah ben David who reigns as the victorious king. Any number of Jewish sources therefore refer this verse to the slaying of the Messiah ben Joseph. At least one commentator believes that the Messiah ben Joseph dies as an atonement for the sins of Israel. Some Jewish sources which take a messianic interpretation of Zechariah 12:10 are as follows:
A marginal reading to the Targum
At this point it is appropriate to note the relevant part of the Reuchlinianus marginal reading: And I shall cause to rest upon the house of David and upon the inhabitants of Jerusalem the spirit of prophecy and true prayer. And afterward the Messiah son of Ephraim will go out to do battle with Gog, and Gog will slay him in front of the gate of Jerusalem. And they shall look to me and shall inquire of me why the nations pierced the Messiah son of Ephraim."1
According to the authors (p. 19), the manuscript known as the Codex Reuchlinianus is dated to the year 1105 A.D. It has "numerous notes and variants...which inhabit its margins." Cathcart and Gordon say, "Many of these marginalia consist of a single-word variant, sometimes of philological and lexical interest, while a significant minority are longer and often midrashic in content."
Babylonian Talmud, Sukkah 52a
And the land shall mourn, every family apart; the family of the house of David apart, and their wives apart [Zech. 12:12]....What is the cause of the mourning? -- R. Dosa and the Rabbis differ on the point. One explained. The cause is the slaying of Messiah the son of Joseph, and the other explained, The cause is the slaying of the Evil Inclination.
It is well with him who explains that the cause is the slaying of Messiah the son of Joseph, since that well agrees with the Scriptural verse, And they shall look upon me because they have thrust him through, and they shall mourn for him as one mourneth for his only son; but according to him who explains the cause to be the slaying of the Evil Inclination, is this an occasion for mourning? Is it not rather an occasion for rejoicing? Why then should they weep?2
Rashi in his commentary to Sukkah 52a (11th c.)
The words, "The land shall mourn," are found in the prophecy of Zechariah, and he prophesies of the future, that they shall mourn on account of Messiah, the son of Joseph, who shall be slain in the war of Gog and Magog.3
וספדה הארץ בנבואת זכריה ומתנבא לעתיד שספדו על משיח בן יוסף שנהרג במלחמת גוג ומגוג.
Note that this interpretation contrasts with Rashi's commentary on the Bible, in which he gives a different interpretation of the passage.
Ibn Ezra (12th c.)
All the heathen shall look to me to see what I shall do to those who pierced Messiah, the son of Joseph.4
אז יביטו כל הגוים אלי לראות מה אעשה לאלה אשר דקרו משיח בן יוסף.
Abrabanel (15th c.)
It is more correct to interpret this passage of Messiah, the son of Joseph, as our rabbis of blessed memory have interpreted in the treatise Succah, for he shall be a mighty man of valour, of the tribe of Joseph, and shall, at first, be captain of the Lord's host in that war, but in that war shall die.5
ויותר נכון לפרשו על משיח בן יוסף כמו שפירשו רז״ל במס׳ סוכה לפי שהוא יהיה איש גבור חיל משבט יוסף ויהי׳ שר צבא ה׳ באותה מלחמה בראשונה והוא ימות באותה מלחמה:
Moses Alshekh (16th c.)
I will do yet a third thing, and that is, that "they shall look unto me," for they shall lift up their eyes unto me in perfect repentance, when they see him whom they pierced, that is Messiah, the son of Joseph; for our rabbis, of blessed memory, have said, that he will take upon himself all the guilt of Israel, and shall then be slain in the war to make an atonement, in such a manner, that it shall be accounted as if Israel had pierced him, for on account of their sin he has died; and therefore, in order that it may be reckoned to them as a perfect atonement, they will repent, and look to the blessed One, saying that there is none beside Him to forgive those that mourn on account of him who died for their sin: this is the meaning of "They shall look upon me."6
ועוד שלישי׳ אעשה והיא כי הביטו אלי שיתלו עיניהם אלי בתשובה שלימה כראותם אשר דקרו הוא משיח בן יוסף שאז״ל שיקבל על עצמו כל אשמו׳ יש׳ ויהרג אז במלחמ׳ לכפר בעד באופן שיחשבכאלי יש׳ דקרו אותו כי בחטאתם מת ועל כן למען יחשב להם לכפרה שלימה יעשו תשובה והביטו אליו ית׳ באמור כי אין זולתו למחול למתאבלים על אשר מת בעונם וזהו והביטו אלי את וכו׳
1. Kevin J. Cathcart and Robert P. Gordon, editors. The Targum of the Minor Prophets: Translated, with a Critical Introduction, Apparatus, and Notes (Wilmington, DE: Michael Glazier, Inc., 1989), p. 218. This is volume 14 in the series The Aramaic Bible.
2. Soncino Talmud edition.
3. Cited in A. M'Caul, Rabbi David Kimchi's Commentary Upon the Prophecies of Zechariah, Translated from the Hebrew with Notes, and Observations on the Passages Relating to the Messiah (London: James Duncan, 1837), p. 161.
4. Cited in M'Caul, p. 158.
5. Cited in M'Caul, p. 159.
6. Cited in M'Caul, p. 163.