Positive commandment · Mitzvat Aseh #192 of 613
To prepare a place [outside] the [army] camp [for use as a latrine]
להתקין יד במחנה
The verse · Devarim 23:13
וְיָד תִּהְיֶה לְךָ מִחוּץ לַמַּחֲנֶה וְיָצָאתָ שָּׁמָּה חוּץ
“Thou shalt have a place also outside the camp, where thou shalt withdraw thyself:”
The Rambam’s words
To prepare a place [outside] the [army] camp [for use as a latrine], as [Deuteronomy 23:13] states: "Prepare a place for yourselves outside the camp."
להתקין יד במחנה, שנאמר: "ויד תהיה לך, מחוץ למחנה" (דברים כג,יג).
Why · Sefer HaChinuch #566
Set up a place in which to defecate
“It is from the roots of the commandment [that it is] like the matter that is written in the section of the Torah [wherein this is mentioned), “Since the Lord, your G-d, moves about in your camp [...], let your camp be holy” which is to say that the souls of Israel always cling to the Divine presence.”
Where in the Mishneh Torah
Hilchot Kings and Wars הלכות מלכים ומלחמות