The Seforim say that the incident of the Ten Martyrs (Asarah Harugei Malchus) took place as an atonement for the TEN people involved in the sale of Yosef. However, this needs to be understood.
We know that Yaakov had twelve sons. Three of them were not involved in the sale! Binyomin wasn’t there, Reuven was away at the time, and Yosef didn’t sell himself! In that case, only nine sons of Yaacov were involved, so who is the tenth? Here are three approaches:
1. Sheloh haKodosh explains that since Reuven initially agreed to throw Yosef into the pit (and to sell him) he was held accountable even though he wasn’t present at the actual sale and evidently did not know about the sale until Yosef mentioned it in Egypt.
2. Rabbenu Bachaye states that Yosef himself was held accountable because of his actions that caused the brothers’ animosity as well.
3. Arizal (word of caution: this needs to be understood properly) states that HaShem Himself had joined in the Beis Din to allow the brothers to sell Yosef.
Additionally, the nine brothers formed a Bais Din also of TEN to take an oath binding on the public not to reveal to Yaacov the details of the sale of Yosef. Three opinions as to the tenth member:
1. Reuven; he accepted the oath since this was part of his approach to doing a complete Teshuvah
2. Yosef; he accepted afflictions and Galus as his role
3. HaShem (per the Medrash mentioned in Rashi)
Reincarnation and Retribution from Shnei Luchot HaBrit by Rabbi Isaiah Horowitz
Because the brothers became guilty of being jealous of Yosef and hating him, as we know from Bereshis 37:4 and Bereshis 37:11, they became victims of Eisav in this world. Since ten of the brothers were guilty of such feelings, the Romans tortured ten outstanding Jewish scholars to death, the ones commonly known as the Ten Martyrs, whom Jewish liturgy eulogized in the poem Eyleh Ezkera, recited on the Day of Atonement. The ten scholars involved were reincarnations of the ten brothers of Yosef who had taken part in selling him. The Heavenly objective was to wipe out the residual guilt of the brothers.
We can find numerous allusions which relate to these Ten Martyrs. According to tradition, Rabbi Yehudah ben Bava had three hundred lonkuyos, lances, stuck into his body. The word "vayitnaklu", meaning "they conspired to kill him", in Bereshis 37:18, is an allusion to this; the letters are simply a re-arrangement of the word "lonkuyos".
In Bereshis 44:17, Yosef said to his brothers, "As for you, go up in peace to your father." The word "atem" [meaning "you"] in that context was used advisedly. Yosef meant that the brothers themselves could come to their Father in Heaven safely, i.e. in this World they would not suffer the execution (as kidnappers who sell their prey). On a future occasion, however, their reincarnated selves would have to pay for the crime with their lives. The Ten Martyrs mentioned were the ones who had to pay with their lives for that sin which had gone unpunished for so long. (Many Seforim mention that the Gematria of the names of the ten Martyrs equals the Gematria of the names of the ten tribes)
There is a group of Kabbalists who do not include Reuven amongst the Ten Martyrs, but substitute Yosef as the tenth. Their reasoning is that, after all, Yosef was the root cause of the crime committed against him. It was Yosef's tale-bearing which triggered the brothers' sin. Some Kabbalists consider that Rabbi Akiva was the re-incarnation of Yosef. This is the reason he is known as Akiva ben Yosef.
Other opinions state that when the brothers included the Shechina at the time they entered into the conspiracy, Rabbi Akiva's torture was due to the fact that he represented the Shechina. According to this view the tradition that he ended his life with the word echod is that he ended his life "because of the echad".
Why did HaShem agree to this oath?
1. HaShem desired fulfillment of prophecy from Bris Bein haBasarim (if Yaacov had known he would have sought to purchase Yosef’s freedom); or He desired atonement for Himself for sending the Jews into Galus. (Mizrachi)
2. HaShem wished to prevent Yaacov from pronouncing an eternal curse upon his children. If his tears resulted in the death of the Ten Martyrs, how much more would be the effect of his curse? (Chemdas Yamim)
3. HaShem desired that Yosef’s 22-year absence without knowledge to his father to be an atonement for Yaacov’s 22-year period of not honoring his parents. (Sefer Chasidim)
