Journeys That Carry Menuchah
במדרש הבורח מה שיחלל השבת כו'
The Midrash teaches regarding one who flees [from danger] that he may desecrate the Shabbos, and so forth.
The Sfas Emes opens by citing a Midrash that touches on the law that someone fleeing for his life may even violate Shabbos to escape — setting up a question about traveling and rest.
הענין כי המסעות היו מקומות שהוצרכו להלחם עם הסט"א כמ"ש ויהי בנסוע כו' קומה ה' ויפוצו אויבך
The matter is that the journeys [of Bnei Yisrael in the wilderness] were places where they were required to wage war against the Sitra Achra, the forces of the Other Side, as it is written, "And it was, when the Aron traveled, [Moshe said:] Arise, Hashem, and let Your enemies be scattered" (Bamidbar 10:35).
He explains that each of the encampments and travels in the desert was a battlefront against the spiritual forces of impurity, which is why the Aron's journeying was accompanied by a tefillah for Hashem to scatter His enemies.
ובודאי באלה הנסיעות הי' מושרש כל הגלות שנתקיים עתה בפועל ואז הי' בשורש דכ' אלה מסעי בנ"י סתם שהמה המסעות שצריכין בנ"י לעבור ולתקן אותם המקומות תמיד
And certainly within these journeys was rooted the entire galus that is now being fulfilled in actuality, while back then it existed at its root, for it is written, "These are the journeys of Bnei Yisrael" without further specification, meaning that these are the journeys that Bnei Yisrael must always pass through and rectify those places.
The journeys of Bnei Yisrael contained the spiritual root of the entire future galus; the Torah's open phrase "these are the journeys" hints that every generation must travel through and rectify these same spiritual places.
אכן אז הי' בדקות שמרוב קדושה שהי' ביניהם נתבטלו כל כחות החיצוניות שהיו באותן המקומות כמ"ש נחש כו' ועקרב כו' וכ' על פי ה' יחנו ועל פי ה' יסעו היינו שגם בבחי' המסעות ובריחות שהיו בורחין ממקום למקום עכ"ז הי' אצלם המנוחה ולא הוצרכו לחלל השבת וכדאיתא בגמ' כיון דכ' על פי ה' כו' כסותר ע"מ לבנות במקומו דמי ע"ש
Yet back then it existed in a refined form, for through the abundance of kedushah that was among them, all the external forces present in those places were nullified, as it is written, "snake... and scorpion..." (Devarim 8:15), and it is written, "By the word of Hashem they encamped, and by the word of Hashem they journeyed" (Bamidbar 9:23), meaning that even within the aspect of the journeys and the fleeings, when they would flee from place to place, nevertheless the menuchah, the state of rest, remained with them, and they were not compelled to desecrate the Shabbos, as is stated in the Gemara that since it is written "by the word of Hashem," it is considered like one who dismantles in order to rebuild in its place — see there.
Back in the wilderness, the immense kedushah of Bnei Yisrael nullified the destructive external forces, so that even while fleeing and moving from place to place, they retained an inner menuchah and never had to desecrate Shabbos — since their travel was directed entirely "by the word of Hashem," the Gemara likens it to dismantling for the sake of rebuilding.
כי כל מסע היא שינוי מקום וביטול המנוחה והשביתה
For every journey is a change of place and the nullification of menuchah and the cessation of activity that is the Shabbos rest.
Normally any journey breaks one's rest, since moving means changing place and losing the stillness that Shabbos embodies.
אבל במסעות שלהם היו ג"כ אצל המנוחה
But in their journeys they too were in a state of menuchah.
But because their travels were guided by Hashem, the journeys themselves carried a quality of rest rather than disrupting it.
וז"ש במד' הרמז שלא הניחן לברוח כו' עכ"ז לפי ערך הנהגה שלהם הי' המסעות כמו ימי המעשה אצל החני' כמ"ש ויסעו ויחנו ויסעו ויחנו שהיו מתעלין משביתה למסע ומשביתה למסע כמו שצריך איש ישראל להיות מתעלה משבת לשבת בנ' שבתות השנה:
And this is what the Midrash means by its hint, that He did not allow them to flee, and so forth — nevertheless, according to the measure of their conduct, the journeys were like the weekdays relative to the encamping, as it is written, "and they journeyed and they encamped, and they journeyed and they encamped," for they would ascend from the cessation of activity to a journey, and from cessation to a journey, just as a Yisrael must ascend from Shabbos to Shabbos across the fifty Shabbosos of the year.
This is the Midrash's deeper hint: even though Hashem did not let them simply flee unrestrained, their level of avodah turned the journeys into weekdays serving the resting-point of encampment, so that each leg of travel was an ascent — just as a Yisrael is meant to rise from one Shabbos to the next throughout the year's fifty Shabbosos.
Summary: The Sfas Emes explains that the journeys of Bnei Yisrael through the wilderness were each a battleground against the forces of the Sitra Achra, and that these travels contained the spiritual root of the entire galus that every later generation must traverse and rectify. In that generation, however, the abundance of kedushah among Bnei Yisrael nullified the external forces of impurity, so that even as they fled and moved from place to place they never lost their inner menuchah and were never forced to desecrate Shabbos. Because their travels were directed entirely by the word of Hashem, the Gemara compares their movement to dismantling only in order to rebuild, so that journeying itself became an act of rest rather than its negation. Thus the very journeys functioned like weekdays serving the encampment's Shabbos-like stillness. Each leg of "and they journeyed and they encamped" was an ascent from one resting-point to the next, mirroring the avodah of a Yisrael who climbs from Shabbos to Shabbos across the fifty Shabbosos of the year.