Why would you not just rely on stored food? While MREs are probably a bad choice due to both shelf life and weight, even with that assumption you would have less weight and trouble than if you tried to grow your own food. Each MRE weighs roughly 625 grams(1.3 lb) with two a day over two years it would be just under a metric ton(912 kg or 2011 lb) per person. That really isn't bad at all considering the weight of everything else you would presumably need for such an absurd expedition. And with better quality meals, it is possible to lower that to well under a quarter of that total. Though that might lead to higher water requirements as those foods are often freeze dried.
Though said solution would likely lead to your troops wanting to revolt by the end, due to the lousy food quality, it would be far more practical than attempting to grow your own food. Unless you happen to be Mark Watney.
The bigger question is why is your army traveling for two years over land? In reality we use air travel and ocean travel to avoid such long trips over land as much as possible. Even when traveling over land, railroads are still the preferred method when possible. One estimate even claimed that it would have been cheaper to build a railroad into Afghanistan than using truck convoys. And what is your fuel source? Unless your soldiers are marching, which begs the question of what possible benefit there could be to such a journey. Any soldier that marches for two years is going to be so ineffective by the time that he meets the enemy that you are all but guaranteed to lose by the time you get there.
And how is it even possible for there to be a two year journey with modern technology unless you are traveling in space? Unless your troops are engaged in combat, in which case they are going to need to be resupplied with fresh ammunition and fuel anyway, it could not possibly take two years to reach any point on an earth sized planet. Unless they are marching, in which case you have the problem I mentioned above.
And what opponent would be worth going after with only 10,000 soldiers? The Bush administration was criticized in Iraq for having less than 300,000 soldiers in country. It is possible for a raid to be carried out against a major nation with a force the size of the one you describe, but that would require an effective transportation ability to get them out of the country. Which would again beg the question of why they had to travel for two years to get there.
A deeper problem with this scenario comes from the fact that in modern times warfare is becoming increasingly cost prohibitive. Despite the fact that many claim that America went to war in Iraq for oil, much of that oil went to the Chinese instead, as they were more able to buy it. That is the lesson in modern times, buying resources is better than going to war to get them. While there is still the possibility of smaller wars, big ones seem to be a thing of the past, especially when one considers the existence of nuclear weapons.