Just before the great event of receiving the Torah, a gradual separation takes place. The leader of the nation steps away from the people and the local leadership to begin his journey to the mountain peak. Rising from his seat after judging the Israelites [מלבי״ם], Moses takes his first steps. He does not walk alone, but is accompanied by his most devoted student.
While the primary approach among commentators is that Joshua was one of the seventy elders, and indeed the greatest among them, highly suited for prophecy [רמב״ן, רבנו בחיי, רלב״ג, ביאור יש״ר], he acts here strictly as an attendant [נתינה לגר]. This highlights that Joshua joined the journey not in his capacity as a distinguished leader, but simply as a student escorting his teacher, ensuring that a wise scholar did not travel by himself [משכיל לדוד, שפתי כהן]. It was precisely this humble dedication to service that earned Joshua the privilege to approach the mountain closer than the other elders, who were instructed to remain behind [אלשיך]. Furthermore, Joshua's role as an escort was directed by God. He was destined to become the primary receiver of the oral tradition, drawing his wisdom from the written teachings of Moses just as the moon reflects the light of the sun [העמק דבר].
As the journey continues toward Mount Sinai [רלב״ג] or its immediate surroundings [העמק דבר], a physical boundary is reached. Joshua accompanies his teacher only up to the permitted limit, remaining there to serve him until Moses is called to the very top, where he would transcend everyday physical needs [קאסוטו, ביאור שטיינזלץ].
From that point onward, Moses ascends alone. Joshua pitches his tent on the slope or at the foot of the mountain, waiting faithfully for forty days [רש״י, רמב״ן, רבנו בחיי, בכור שור]. During this long wait, he is sustained by the manna that continues to fall directly around him each day [אבן עזרא, חזקוני]. His complete isolation on the mountain is evident. When Moses finally descends, Joshua hears the noise of the Israelites but is entirely unaware of the sin of the Golden Calf that took place in the camp below [רש״י, רמב״ן, אבן עזרא, רבנו בחיי, ביאור יש״ר].