"Yet there shall be a space between you and it, about two thousand cubits by measure" (Joshua 3:4). Joshua said to them: You are destined to stand there and to keep the Sabbath there; do not go farther from the Ark than two thousand cubits in every direction, so that you will be permitted to come and pray before the Ark on the Sabbath. And so you find that when the Holy One, blessed be He, told Moses that they should make standards for themselves, He said to them: Set your standards toward the Ark in every direction, as it is said, "every man by his own standard, with the ensigns" (Numbers 2:2). Here it is written, "and she sat over against him, a good way off, as it were a bowshot" (Genesis 21:16), and elsewhere it is written, "over against the tent of meeting round about" (Numbers 2:2). We learn the meaning of "over against" -- a good way off -- from "over against" [in the other verse], teaching the measure of distance.
Two Thousand Cubits From the Ark and the Sabbath Boundary
Yalkut Shimoni on Nach 13:2
אך רחוק יהיה ביניכם וביניו כאלפים אמה (יהושע ג, ד). אמר להם יהושע עתידים אתם לעמוד שם ולעשות שם את השבת אל תרחקו מן הארון יותר מאלפים אמה לכל רוח שתהיו רשאין לבא להתפלל לפני הארון בשבת, וכן אתה מוצא כשאמר הקב"ה למשה שיעשו להם דגלים א"ל השרו דגליכם לארון לכל רוח שנאמר איש על דגלו באותות וגו'. כאן כתיב ותשב לה מנגד הרחק כמטחוי קשת ולהלן כתיב מנגד סביב לאהל מועד למדנו נגד מנגד הרחק (מהרחק) [מרחוק]: