The Rambam wrote the Mishneh Torah before he wrote the Moreh Nevuchim. This led me to wonder if he changed his mind on certain topics that might be reflected by an apparent contradiction between the Mishneh Torah and the Moreh Nevuchim, hence my question.
There are certainly things that appear to be contradictions. One popular example is in Hilchot Tefilah 9:7 where he writes:
מי שאמר בתחנונים מי שריחם על קן ציפור שלא ליקח האם על הבנים או שלא לשחוט אותו ואת בנו ביום אחד ירחם עלינו וכיוצא בענין זה משתקין אותו מפני שמצות אלו גזרת הכתוב הן ואינן רחמים שאילו היו מפני רחמים לא היה מתיר לנו שחיטה כל עיקר
One who says in his supplicatory prayers: "May He who showed mercy on a bird's nest prohibiting the taking of the mother together with the chicks, or the slaughter of an animal and its calf on the same day, also show mercy on us," or [makes other] similar statements should be silenced, because these mitzvot are God's decrees and not [expressions] of mercy. Were they [expressions] of mercy, He would not permit us to slaughter at all.
However, in Moreh Nevuchim 3:48 he seems to say the opposite:
The same reason applies to the law which enjoins that we should let the mother fly away when we take the young. The eggs over which the bird sits, and the young that are in need of their mother, are generally unfit for food, and when the mother is sent away she does not see the taking of her young ones, and does not feel any pain. In most cases, however, this commandment will cause man to leave the whole nest untouched, because [the young or the eggs], which he is allowed to take, are, as a rule, unfit for food. If the Law provides that such grief should not be caused to cattle or birds, how much more careful must we be that we should not cause grief to our fellowmen. When in the Talmud (Ber. p. 33b) those are blamed who use in their prayer the phrase, "Thy mercy extendeth to young birds," it is the expression of the one of the two opinions mentioned by us, namely, that the precepts of the Law have no other reason but the Divine will. We follow the other opinion.
(I happen to think the contradiction is more elaborate than this, but this is how it is commonly cited.)
Many resolutions have been suggested over the centuries (though most, if not all, don't seem entirely satisfactory), and some have indeed suggested that Rambam simply changed his mind. For instance, in Torah, Chazal, and Science R. Moshe Meiselman writes:
An example of this is the apparent reversal in Moreh Nevuchim of his own ruling in the Mishneh Torah regarding one who says that the mitzvah of shiluach haken – sending away the mother bird before taking the chicks – is an example of God's mercy.
Another example is that in Hilchot Beit Habechirah 1:13 he writes:
המזבח אין עושין אותו אלא בנין אבנים (גזית) וזה שנאמר בתורה מזבח אדמה תעשה לי שיהיה מחובר באדמה שלא יבנוהו לא על גבי כיפין ולא על גבי מחילות וזה שנאמר ואם מזבח אבנים מפי השמועה למדו שאינו רשות אלא חובה
The Altar should only be made as a structure of stone. Though the Torah states, [Exodus 20:24]: "You shall make Me an altar of earth," [that verse is interpreted to mean that] the altar must be in contact with the earth and not built on an arch or on a cave.
Yet in Moreh Nevuchim 3:45 he writes:
The commandment that the stones of the altar shall not be hewn and that no iron tool shall be lifted up upon them (Deut. xxvii. 5), has been explained by our Sages as follows: It is not right that the tool that shortens man's life should be lifted up upon that which gives length of life. As an Agadic explanation this is good: but the real reason is this: the heathen used to build their altars with hewn stones: we ought not to imitate them. For this reason we have to make an altar of earth: "Thou shalt make unto me an altar of earth" (Exod. xx. 24); if it should be impossible to dispense altogether with stones, they must not be hewn, but employed in their natural state. Thus the Law also prohibits from worshipping over painted stones (Lev. xxvi. 1), or from planting any tree near the altar of the Lord (Deut. xvi. 21).
Maimonides’ Mishneh Torah, is known by many as the second Torah and Talmud, for he writes in the introduction:
“a person will not need another text at all with regard to any Jewish law.” Instead, “a person should first study the Written Law [the Torah], and then study this text and will then understand the entire Oral Law [the rabbinical enactments] from it without having to study any other text other than these two.”
Contrary to what many people think, Mishneh Torah does contain philosophy. In the Mishneh Torah “Code of Jewish Laws,” Laws of Kings 11:3, chapters 11 and 12, Maimonides explains that the Messianic age will be a natural event.
The Guide of the Perplexed
Maimonides’ Guide of the Perplexed is his philosophic works. Yet the work is contradictory. This was because he was writing for two audiences. For example, in the Mishneh Torah he expressed his belief in angels but in the Guide (2:6,) he equates them to the natural forces. G-d is all-powerful and needs no helpers. More examples are the sacrifices, which the Rambam writes were a concession for humans (see Guide 3:32).
In the introduction to the Guide, Maimonides spells out his technique of implementing the fifth and seventh contradictions, writing:
“Do not read superficially, lest you do me an injury, and derive no benefit for yourself. You must study thoroughly and read continually; for you will find the solution of those important problems of religion, which are the source of anxiety to all intelligent men.”