Deuteronomy 23:10-15 says:
"And you shall have a peg among your weapons; when you sit outside, you will dig with it, sit, and cover your waste. For HaShem your G-d travels in the midst of your camp, to save you and to put your enemy before you, and your camp shall be holy. Nothing which should be covered will be seen, lest He leave you."
On this, Rabbi Samson Raphael Hirsch comments:
"When you leave the normal boundaries of family and civil life, and you are in a military camp arranged against your enemies, then even though you are in a military camp, where the ethical reins are easily loosened and the actual goal of war is an unrestrained coarseness – then, too, 'guard yourself against every bad thing.' Do not cease examining yourself, with self-control, and be on guard against 'every bad thing.'"
Have a great day,