Depends on the age and overall health of the animal. If it's just a mater of inactivity, they're a great deal like humans, in that "fitness" can be achieved in a realtively short time. I would expect, compared to our horses here in the western U.S., that an exercise program and proper nutrition will produce a workable animal in as little as 1 or 2 months...
Plus.... it also depends on how the horse has been spelled. If simply left to its own devices in a field somewhere it will take a lot longer than if it has been properly agisted.
Two years is a long time to spell a horse. If you're gonna pay someone to work/train or whatever, it would certainly be a good idea to have a proper vet check done before throwing away good money.
Horses are on the hoof 24/7 so are fit so long as they can stand & move. If for muscling-up for eventing then it could take the season for small events.
It depends on what the horse's done previously, and what you expect from it now. Two years IS a long time, so after an all-clear from the vet, start off with gentle exercising for up to 45 minutes at a time.
I agree with tamborine, it could take a full season to regain fitness - easily 5-6 months.