The prophet Amos in 5(18) states, "Woe to those who desire the Day of Hashem (the Day of Judgment). Why do you seek this Day of Hashem? It is darkness and not light." To obtain a rose from its bush, one must carefully pass through the thorns. To get to the joyous festival of Succos, one must make it past the affliction of Yom Kippur. To earn the rewards of the "world to come" one must survive the perils of "this world." To experience the fruition of bringing a life into this world, one must experience the pains of childbirth. And to see the light of redemption, one must survive the travails of the days preceding Mashiach.
Several verses later Hashem scolds the Jewish People and says that He hates their insincere offerings and assemblies. He will not hear their songs and music. All G-d wants is true justice and righteousness. After all, G-d reminds us, I didn't require you to bring personal offerings during your 40 years of wandering in the Wilderness. The Gemara Sanhedrin cites a Baraisa: R' Eliezer says, "The Messianic Era will last 40 years," and he teaches that it will last as long as the "days You afflicted us." This refers to the years in the Wilderness. So like our wandering, the Messianic Era will last 40 years. And like the above examples, the darkness of affliction must precede the reward of light. Our 40 years of wandering preceded the reward of receiving the Land of Eretz Yisroel.
In the same gemara, Shmuel is quoted as saying that there is no difference between this world and that of the Messianic Era except for Jewish independence from the dominion of foreign kingdoms. The natural laws and even the basic norms of society will not change in the Messianic Era. The only major difference will be that the Jewish People will enjoy independence from foreign rule. This view is adopted by the Rambam who writes, "Do not think that in the Messianic Era any of the current norms will cease or that there will be a change in the natural order. Rather, the world will function in its normal manner. After Mashiach comes human society will be so exalted that "there will be no war or hunger, no jealousy or competition."
The words that describe our independence from foreign rule are, שׁעבּוד מלכיות בּלבד. These words have a gematria of 926. During this period of time, many non-Jews will join the Jewish People when the outcome of the redemption does not culminate in the manner they were taught. This is similiar to our redemption from Egypt when the Erev Rav became part of the Jewish Nation. But in a similiar manner to the complaints of the Erev Rav in the Wilderness, the people who will shortly join (who are not used to the constant afflictions the Jewish People have suffered) will begin to murmur. In fact, the word תּלונתם which means their murmurings, have the same 926 gematria. In a similiar manner as in the Wilderness, we will be isolated, provided for, protected, and will be able to draw close to Hashem. We will learn His ways and teachings through Mashiach in a similiar manner to the way Moses taught the Jewish People in the desert. It's very interesting how the gemara connects the 40 years in the Wilderness to the 40 years of the Messianic Era. So it's amazing that the phrase, ארבּעים שׁנה בּמדבּר, "forty years in the Wilderness" also has the same 926 gematria.