Devarim / Deuteronomy 23:15 · Pshat
כִּי יְהוָה אֱלֹהֶיךָ מִתְהַלֵּךְ בְּקֶרֶב מַחֲנֶךָ לְהַצִּילְךָ וְלָתֵת אֹיְבֶיךָ לְפָנֶיךָ וְהָיָה מַחֲנֶיךָ קָדוֹשׁ וְלֹא־יִרְאֶה בְךָ עֶרְוַת דָּבָר וְשָׁב מֵאַחֲרֶיךָ׃
For the Eternal your Almighty walks in the midst of your camp, to save you and to give up your enemies before you. Therefore your camp shall be holy, so that He sees no shameful thing among you and turns away from you.
Pshat פְּשָׁט
As in the Temple
On a march, in the field, in a hurry, it is easy to decide the rules stayed at home. The Torah tells soldiers in the camp the opposite.
Shadal: the main thing is that the soldiers remember that the Eternal goes before them and salvation is from Him. The camp's cleanness is not for the ark and not for the air, but so that they stand in awe, as in the Temple. Rashbam thinks otherwise: the ark with the Torah went out with them to war. Rashi: "sees" — the Holy One, blessed is He.
How Shadal, Rashbam, and Rashi explain it
Shadal Therefore your camp shall be holy
The main thing is to fix in their hearts that the Eternal goes before them and salvation is from Him. So He commanded that they always set the Eternal before them, as if they were in His Temple.
But it is not because of the ark: most often it did not go out with them to war. And it says: "so that He sees no shameful thing among you and turns away from you," and there is no doubt that the ark would not turn back for this. And covering the excrement is not so that the air will not be spoiled: the law of impurity from an emission of seed stands next to it, and that does not spoil the air. All this is so that they stand in awe, as if they were in the Temple of the Eternal.
Rashbam Walks
Because the ark, in which the Torah is, also went out with them to war. As it is written: "and the holy vessels and the trumpets for the alarm in his hand" (Bamidbar / Numbers 31:6).
Rashi So that He sees no
The Holy One, blessed is He, a shameful thing.
Takeaway
The verse closes the laws of cleanness in the war camp: going outside the camp to relieve oneself and covering the excrement (Devarim / Deuteronomy 23:13–14). Before them is the law of impurity from a night emission (Devarim / Deuteronomy 23:11–12).
Shadal and Rashbam disagree about the ark. Rashbam cites the war with Midian, where the holy vessels were in Pinchas's hand (Bamidbar / Numbers 31:6).
Rashi clarifies who "sees": the subject of the verse is the Eternal, not the soldier.