Under the Law of Moses, the Lord regulated the handling of dead bodies, and note here that He did not forbid touching a dead body, nor did He declare that someone committed sin when touching a dead body, just simply that such person had become unclean.
Therefore, while unclean that Israelite could not do somethings, necessitating the need for becoming clean once again,
“He who touches the dead body of anyone shall be unclean seven days. He shall purify himself with the water on the third day and on the seventh day; then he will be clean. But if he does not purify himself on the third day and on the seventh day, he will not be clean” (Numbers 19.11).
The Lord made Himself clear how an ancient Israelite could purify himself, and that if he did not follow this procedure, he remained unclean.
The procedure required purification with water, after which the Israel became clean on the seventh day.
- Numbers 6.9 – Nazirite re-consecrated with a seventh-day shaving (sevensinthebible.com)