וְנָסַ֗ע דֶּ֚גֶל מַחֲנֵ֣ה בְנֵי־דָ֔ן מְאַסֵּ֥ף לְכָל־הַֽמַּחֲנֹ֖ת לְצִבְאֹתָ֑ם וְעַל־צְבָא֔וֹ אֲחִיעֶ֖זֶר בֶּן־עַמִּישַׁדָּֽי׃
און עס האָט געצױגן די פֿאָן פֿון דעם לאַגער פֿון די קינדער פֿון דָן, די הינטערװאַך פֿון אַלע לאַגערן לױט זײערע מחנות; און איבער זײַן לאַגער איז געװען אַחיעזר דער זון פֿון עַמישַדָין.
Rashi
מאסף לכל המחנת [THEN THE BANNER OF THE CAMP OF THE CHILDREN OF DAN SET FORWARD] WHICH WAS THE GATHERER OF ALL THE CAMPS — The Talmud Yerushalmi Eruvin 5:1 has the following statement: Because the tribe of Dan consisted of numerous troops (i. e. was more numerous than each of the other tribes, except Judah which marched on the front, cf. Chapter II), it marched in the rear so that if anyone of the other tribes lost anything, he (Dan) restored it to him. (מאסף לכל המחנת therefore means “the one who gathered in everything belonging to all the camps”.) — There is one authority that holds that they traveled in formation like a box (i.e. in a military square) and derives this from the text, (Numbers 2:17) “just as they encamp so shall they journey” , and there is another authority that maintains that they traveled in a straight line like a beam, and derives this from the statement that Dan was “the gatherer of all the camps”.
Chizkuni
מאסף לכל המחנות, “the rearguard of all the camps. (army groups) Rashi comments that the reason why the tribe of Dan formed the rearguard was that it was very numerous. Anyone who had lost something during the journey would hand it in to members of that tribe awaiting the loser to claim it. This follows the opinion that the Israelites were moving in the pattern of a box. The camp of Dan was in a northerly direction as a matter of routine. [The land of Israel being situated north of the land of Egypt, this would be normal. Ed.] Seeing that they numbered so many soldiers they could spread out over a wide area so that the left flank would actually be partially in the west. It would therefore be appropriate to apply the term מאסף, “ingatherer,” to that army group headed by the Danites. If you were to argue that according to the text of the Torah, the army group headed by Yehudah numbered about 16000 more soldiers than that of Dan, what Rashi meant was that of the three tribes comprising the army group headed by Dan, the tribe of Dan itself was more numerous that the other two tribes that formed part of his army group. The members of the tribe Dan itself were the hindmost of all the tribes in the various army groups.
Siftei Chakhamim
They traveled in the shape of a box. Like Rashi explains in Parshas Bamidbar (2:9) — the banner of Yehudah was on the east, Reuven’s on the south, Ephraim’s on the west and Don’s on the north. Therefore they had to spread out to a width of two banners and consequently [Don] had to be heavily populated. However, according to the opinion that they traveled one after the other in the shape of a beam, and deriving this from “gatherer for all the camps” — even if Don was not heavily populated, they could gather whatever was lost. You might ask: The tribes [traveling under the banner] of Yehudah were more populous than the tribes [traveling under the banner] of Don, because the tribes [traveling under the banner] of Yehudah comprised 186,400 while the tribes [traveling under the banner] of Don totaled only 157,600, as the Torah writes in Parshas Bamidbar (2:9, 31). (Gur Aryeh) answers: Yehudah traveled first, given that he was the king, and therefore the last to travel was Don who had the largest population after Yehudah.