The Midrash (Shir Hashirim Rabbah 2:7) tells us the reason for the oath against going up as a wall: “If so, why does the king moshiach have to come to gather the exiles of Israel?”
The Yefei Kol explains: “If we come up as a wall from exile, why will the king moshiach have to come to gather the exiles of Israel? And since we know from many verses in Tanach that moshiach will gather our exiles, we cannot gather ourselves together.”
On the words of the Gemara (Kesubos 111b), “The Holy One, blessed is He, made Israel swear not to go up as a wall.” Rashi says, “Together, with a strong hand.” This seems to mean fighting a war to leave exile..
The Yefei Kol asks on Rashi: If going up as a wall means fighting a war to leave the exile, then why do we need an extra oath for that? There is already an oath not to rebel against the nations. He gives two answers. The first is that rebelling against a nation means only refusal to obey its laws while living under it, such as paying taxes. But if a nation does not allow its Jews to leave, and they sneak out, that is not rebellion. For that we have a special oath not to go up as a wall.
There is a flaw in this answer. It assumes that “going up as a wall” is a form of rebellion against the host country under which Jews live in exile. If so, sneaking out of one’s country should be a violation of this oath, no matter where the Jew is going – for example, from the Soviet Union to America. But we know that the oath only prohibits going to Eretz Yisroel. The entire page of Gemara in Kesubos is discussing only going to Eretz Yisroel.
Perhaps this is why the Yefei Kol offers a second answer: that going up to Eretz Yisroel is prohibited even with the permission of the nations. Since Hashem is the one who scattered us, we are not allowed to gather ourselves together, but rather we must wait until Hashem sends moshiach to gather us.
It is interesting that the compiler of the abridged Yefei Kol (printed in the standard Vilna edition of the Midrash Rabbah) only brings the Yefei Kol’s first explanation, which, we have shown, is so problematic.
The Yefei Kol brings proof to this from the fact that the words “as a wall” are used elsewhere by Chazal to mean peaceful immigration, with permission from the ruling power. “If she is a wall, we will build on her a fortress of silver” (Shir Hashirim 8:9). Chazal explain (Yuma 9b): “If you had made yourselves like a wall and come up, all of you, in the time of Ezra, then you would have been comparable to silver, which does not rot.” Similarly, the Midrash Rabbah on this verse says: “If Israel had come up as a wall from Bavel, the Beis Hamikdash would not have been destroyed for a second time at that time.” Now, we know that Cyrus and later Darius gave permission for the Jewish people to return to Eretz Yisroel. Had they all gone up, it would not have necessitated military conquest. Yet Chazal use the expression “as a wall.” This shows that “as a wall” does not mean by military force, but refers to any mass immigration.
The Yefei Kol brings a second proof to this from the words of the Midrash on Shir Hashirim 2:7: ““If so, why does the king moshiach have to come to gather the exiles of Israel.” He understands this to mean: If we gather ourselves to Eretz Yisroel, why does the king moshiach have to come to gather the exiles of Israel? And since we know from many verses in Tanach that moshiach will gather our exiles, we cannot gather ourselves together - even with permission from the gentiles.
The Yefei Kol does not say explicitly that he is disagreeing with Rashi and it is unlikely that he would disagree with Rashi. Rather, he is saying that Rashi also means that the oath applies even with permission from the nations. Rashi’s words “with a strong hand” mean with great effort and urgent appeals, similar to the meaning of the words in Shemos 6:1, "With a strong hand he will expel them from his land." Pharaoh did not use force or warfare to expel the Jews from Egypt; he came knocking humbly on Moshe and Aharon's door, begging them to leave (Rashi on Shemos 11:8).
According to this we can answer another question. Rashi's words were "together, with a strong hand." If Rashi meant warfare, then how did he know that the oath only applies when all of the Jewish people are together? If it is the rebellion that the oaths come to forbid, shouldn't rebellion by a small group of Jews also be forbidden? But now that we understand that the oath applies even with gentile permission, Rashi has to write the word "together" because that is really the definition of "as a wall": any mass immigration. Then he writes "with a strong hand" to explain why mass immigration is metaphorically described as a wall: because it requires strong efforts, just as a wall is strong. (Vayoel Moshe 1:17)
The Midrash (Shir Hashirim 2:7) lists the Children of Ephraim as one of the instances when the Oath was violated. They counted the 400 years of Egyptian exile from the time when the decree was made, when the Holy One, blessed is He, spoke to Avraham at the Covenant Between the Parts. But in reality the count began 30 years later when Yitzchak was born. What did they do? They gathered together and went out to war, and many of them fell dead. Why? “Because they did not believe in Hashem, neither did they trust in His deliverance” (Tehillim 78:22).
The Yefei Kol on the Midrash asks: The children of Ephraim based themselves on their understanding of Avraham's prophecy. So why is this called not believing in Hashem and not trusting in His deliverance? Why is this transgressing the Oath? It was a mere mistake! The answer is, he says, the mistake was deeper than just a misinterpretation of numbers. They thought that when the foretold time came, the Jews would leave Egypt with their own strong hand, without the open intervention of Hashem. Thus they did not rely on the deliverance of Hashem, but on their own swords. Had they understood that the Exodus would be a miraculous event, they would certainly not have taken the initiative without seeing a miracle to demonstrate that this was Hashem's plan. Even when the real redeemer – Moshe Rabbeinu – eventually came and claimed that Hashem had sent him, the Jews were not allowed to believe in him without seeing a miracle. And they had a tradition that the true redeemer would say the words "pakod pakadti". Since the children of Ephraim had no such redeemer, they could not have left Egypt relying on Hashem's deliverance. Clearly, they thought that they would succeed in leaving Egypt and conquering Canaan through purely natural means. This is why the Midrash says that "they transgressed the Oath" – the oath that prohibited the Jews from leaving the exile on their own, without Hashem's intervention. And "they transgressed the End" – since there was no sign from Hashem, they should have realized that their numerical calculation was wrong.