The Rosh writes in his responsa (Klal 5 paragraph 4) that one cannot impose an oath on people who are unborn. But one may impose a ban or a curse. [Thus, for example, when a community accepts upon itself a new law, such as not eating legumes on Pesach, it cannot work as an oath, because that would not obligate the next as-yet unborn generation. It can only work as a ban or a curse upon whoever eats legumes.] This view of the Rosh is codified as law in Shulchan Aruch Yoreh Deah 228:35, and no dissenting opinion is mentioned. See the Vilna Gaon there [who explains the Rosh’s reason: an oath can only take effect on someone who heard it and answered amein. But a ban or a curse is effective even for those who did not hear it, as the Pirkei Rabbi Eliezer (37) says, that the “oath” made at the War of Pilegesh Bagivah was actually a curse, and that is why it affected the people of Yavesh Gilad despite the fact that they did not hear of it.]
According to the Rosh, how could the oaths at the Giving of the Torah and the oaths against forcing the end take effect on future generations? We don’t find it written in any place that they were not oaths, but rather bans or decrees. It seems that they were real oaths, so how do they work? The Ramban discusses this in his work “Laws of the Ban” but his words are hard to understand, and he does not mention this question.
Now, regarding the oaths at the Giving of the Torah, we can answer the question quite easily. Chazal famously say that when the Torah says, “I am making this covenant with whoever is here today, and whoever is not here today” (Devarim 29:14), it means that all Jewish souls that will be created till the end of time, and even future converts, were standing there when the Torah was given and during the covenants and the oaths. If so, this oath did not have to be imposed on those born later – they were already present then. However, we don’t find that such a gathering of souls was done for the oaths of exile and forcing the end.
Possibly, the answer is that the oaths of exile were also spoken at Sinai. Chazal say (Shevuos 39a) that at Sinai, the Jewish people accepted not only the mitzvos given at that time but also Rabbinic obligations enacted later, such as the mitzvah to read the Megillah on Purim. The Midrash Rabba on Yisro (28:6) goes even further and says:
All the prophecies that the prophets later spoke, they received from Mount Sinai… as it says (Malachi 1:1), “The burden of the word of Hashem to Israel in the hand of Malachi.” It does not say “in the days of Malachi” but “in the hand of Malachi,” to indicate that the prophecy was already in his hand from Mount Sinai, only he was not granted permission to speak it until that time. And similarly, Yishaya (48:16) says, “From the time that it existed, I was there” – on the day when the Torah was given at Sinai, I was there and I received this prophecy. Only “now G-d sent me” – but until now I did not have permission to speak my prophecy. Not only the prophets, but even the Sages who arose in every generation – each received his teachings from Sinai.
Accordingly, Shir Hashirim, which is “holy of holies” (Yadayim 3:5) more than all of the Scriptures, as Chazal say, was certainly said already at Sinai – for it is no less important than the other prophecies and words of Chazal. If so, the verses of the Three Oaths, “I have adjured you, daughters of Jerusalem” were also given at Sinai, so the oaths were given to all the souls who were present, including those who would be born later.
But the problem with this answer is that one of the oaths is upon the nations of the world: Hashem adjured them not to persecute Israel too much, as the Gemara and the Midrash say. Here we cannot answer as above, since the nations were not present at Sinai, only the future converts. And this does not mean that all the non-Jewish souls were there, lest they become converts – Rabbi Menachem Azariah of Fano says in Asarah Maamaros that the souls of converts are actually souls from the Jewish people who were scattered among the nations.
The Avnei Nezer in Siman 454 argues that not only is it hard to understand how the oath worked for those born later – even those alive at the time Shir Hashirim was written never accepted the oath. We don’t find that Shlomo gathered the entire Jewish people to administer these oaths to them, as they were gathered at the Giving of the Torah. Furthermore, he asks, how could the nations’ oath take effect if they didn’t even know of its existence? He answers that the nations’ oath was administered to their guardian angels, and the Jewish people’s oaths were administered to the roots of their souls in heaven. He goes on at length about this.
[The Avnei Nezer admits that an oath imposed on the soul would not obligate the body (as the Akeidah asks – see Siman 35) but argues that “I will permit your flesh as the gazelles and deer of the field” is not to be understood as a direct punishment, but as a cutting off of Hashem’s protection that comes as a result of the sin. If the Jews violate the terms of exile and conquer Eretz Yisroel or fight against the nations, Hashem will ask their souls why they did it, and the souls will answer, “We tried our best to push the bodies in the right direction, but they did not listen to us.” Then He will call their bodies in for judgment, but the bodies will reply that they never took any oath; only the souls did. Each has a good excuse, but the connection between body and soul has been ruptured. Hashem’s providence and supervision is removed from the body, and the body is left as ownerless as the wild animals, which have no soul. The Rambam in Moreh Nevuchim (3:17) and the Chinuch in Mitzvah 169 write that Hashem’s supervision does not apply to the particulars of each animal but only to the preservation of the species. The same will be the case for a human being who distances himself from his soul.
Of all wild animals, the gazelle and the deer are singled out because they are used elsewhere as the symbols of detachment from holiness. In three places, when the Torah wants to teach us that meat is not holy, it says “like the gazelle and the deer.” Devarim 12:15, says Rashi, is talking about sacrificial animals that became blemished and were redeemed with a replacement animal. The new animal is brought as a sacrifice instead, and the blemished one may be eaten as plain meat without any special restrictions. The Torah uses the same comparison in 12:22 when referring to plain meat that was never designated as a sacrifice, and in 15:22 when referring to a firstborn animal that became blemished and is permitted to eat as plain meat.
In two out of those three places, the Torah is discussing meat that was once holy but now its holiness has been removed. Here also, the result of violating the oaths of exile is that one is cut off from his source of holiness and removed from Hashem’s supervision.]
It sounds as if the Avnei Nezer would have been satisfied if Shlomo had indeed gathered all the Jews of his time, but I don’t see how that would have helped for the future generations who did not exist at the time. But I have already answered that the oaths took effect at the time of the Giving of the Torah, and Shlomo only revealed the prophecy later. At the Giving of the Torah, Hashem miraculously brought all future souls to accept the oaths.