When Israel camped in the wilderness, they set up toilet facilities outside the camp area. The camp was holy because Yahweh walked there, and He told Israel to keep it free of uncleanness (Deuteronomy 23:12-14).
The phrasing of Moses’s warning is odd: “Yahweh must not see the nakedness of anything among you lest He turn away from you” (v. 14). How is excrement a form of nakedness? The idea seems to be that excrement is hidden in the body, and when it is expelled it’s an exposure. The body is the “clothing” for what’s inside, and when what’s inside comes out it’s like stripping off clothes.
This gives us an insight into the logic of Israel’s rules of impurity. Virtually all of them involve the exposure of bodily fluids and features that normally remain hidden. Menstruation, emissions from the penis, skin disease in which the flesh shows through the skin, childbirth - all of these are specifications of “nakedness” since in each case something inside comes out. Not all forms of exposure of the inside are considered nakedness. If an Israelite cut his finger, the blood did not make him naked. But when something comes out from the inside through the sexual organs, it is nakedness.
And this in turns takes us back to the origins of impurity: Adam and Eve saw that they were naked and they were ashamed and hid from God. Israel, the new Adamic people, were similarly prohibited from standing in the presence of God naked, or when God might see “the nakedness of anything” on their flesh, in their house, or in the holy camp.