With the assumption that evil exists so that we have free will and that it gives purpose to doing good (c.f. this answer), what will happen in the messianic era when there will be no evil? Can we conclude that there will be no free will or purpose to doing good in the World to Come?
But, as Dovid HaMelech wrote and alluded to above, the time will come when both the spiritual AND physical life will become simple, in the days of Moshiach, when there will no longer be a yetzer hara to confront us and make us rationalize against that which we know to be true in our hearts.
However, THEN, we will receive NO reward for choosing that right path because, without a yetzer hara, we will do so naturally. It is NOW, before Moshiach comes and ushers in that near-perfect existence, that we earn reward for putting spiritual values above materialistic ones. It is now, through our free-will choices, that we earn merit in the ultimate Eretz Yisroel: the World-to-Come
As to the purpose of Torah and Mitzvos when Moshiach comes, see Tanya Igeret Hokodesh Epistle 26:
But when the Shechinah will emerge from kelipat nogah [or: from the kelipot], after the extraction of the sparks will be completed, and the evil of the kelipot will be separated from the good of holiness, “and all the workers of evil will be dispersed,” and the Tree of [Knowledge of] Good and Evil (which is of kelipat nogah and which prevails during the time of exile) will no longer be dominant, because the good will have departed from it,
Kelipat nogah is influential only by virtue of its minimal component of good; as soon as this is extracted, kelipat nogah will have no dominion whatever.
then people will engage in the study of Torah and in the observance of the commandments not in order to extract the sparks, as in the present, but in order to bring about the consummation of yichudim (“unions” or “marriages” of Sefirot) more sublime than those which are effected through our present Torah study — in order to call forth more sublime lights, transcending Atzilut.
This is explained in the writings of R. Isaac Luria, of blessed memory.
Everything [will be accomplished] by means of the pnimiyut of the Torah, the esoteric dimension of the Torah, by the performance of the commandments with lofty mystical devotions directed to [drawing down] sublime “lights” [from the Divine Luminary].
For the root of the commandments is exceedingly high, in the blessed Ein Sof, at a level loftier than Atzilut.
The Lubavitcher Rebbe explains that there are 3 general periods of time.
- Nowadays, before the times of Moshiach.
- After Moshiach comes, the Rambam says that the world will continue to function like nowadays, and Mitzvos will continue like nowadays (just in the ultimate manner).
- During the Ressurection period, "Mitzvos", as "commandments" will be nullified. However, "Halachos" will not, meaning that nowadays we need "mitzvos" to connect ourselves to Hashem (Mitzvah is from the word "Tzavsa", or connection). In this third period of time, our bodies will naturally be nullified to Hashem, and our bodies will physically be unable to violate a commandment.
It says in the Midrash that Hashem created the wold because he wanted a dwelling place in the lower worlds. Meaning, that the lower worlds (physicality) should be nullified to Hashem. So, in reality, this period is for what Hashem created the world.
Maimonides writes (I'm paraphrasing off the top of my head, will give citation later):
The prophets and sages did not prophecy and await the days of the Messiah so they could rule the world; rather, so they could have their time free to delve in the Torah and its wisdom, to better merit the World to Come.
Did Adam have Free Will before eating from the fruit of the Eitz haDaas (Tree of Knowledge)?
According to the Rambam (Moreh Nevuchim 1:1-2), Adam and Chavah had no inclination to do evil, but they did have to discern between truth and falsehood. If someone has the best of intentions but a mistaken idea about reality, they will still make bad decisions and end up doing evil.
Rav Dessler says something that dovetails well with this idea. That before the sin, they had a yeitzer hatov (good drive) but the yeitzer hara (evil drive) was external, in the form of the snake. And the sin internalized it. I would note that this too means that before eating the fruit, Chavah would have to choose whether or not to believe the external yeitzer hara, and Adam, whether to follow along. A choice about what's true.
If the messianic era or the post-resurrection era involves a return of humanity to that pre-sin state, it implies we would be back to trying to figure out truth from falsehood, so that we can correctly pursue our desire to be good.
Just to add another nuance to this, we can see from this and related questions that the idea of contrast is only a creation. From Hashem's point of view, He doesn't need evil to appreciate the intrinsic value of good. So yes, there will be good, not because good has a purpose, but because good is a purpose.