The Tur writes that we do not need to seek out the reasons for mitzvos, for they are the King’s commandments, even if we do not understand the reason.
The Beis Yosef defends the Rambam, and he writes that there is no one who is concerned for the honor of the Torah and its mitzvos more than the Rambam. Although the laws of the Torah can be decrees from the King, nevertheless, wherever a reason for the mitzvah is found, it may be said. Whenever a reason cannot be found, it should be attributed to our shallow understanding. We are, nonetheless, obligated to fulfill those mitzvos that we do not understand its reasons in the same manner as we are obligated to fulfill those mitzvos that we do understand.
He concludes that the Rambam did not think up the reason for these mitzvos himself; rather, he saw from the juxtaposition of the verses that this is the reason for these prohibitions.
The Rama explains the Tur: Heaven forbid to think that the Tur suspected the Rambam to mean that if one does not understand the rationale for a mitzvah, he is not obligated to fulfill it. No sage will believe such a thing! However, those heretics who deny the truth of the Torah only believe in a mitzvah that they understand its reason. Rather, the following is the way that the Tur understood the Rambam: It is only if one shaves his head or destroys his beard in the same manner that the idolaters do; that is when one has transgressed this prohibition. The Tur writes that it is forbidden in any fashion whatsoever. Since the reason is not explicit in the Torah, the prohibition always applies. There is no room for leniency in a place where the reason is not applicable!