1. Obviously if they are horribly thin, feed them up and keep them on pasture rest. Body condition score less than 3 of 9.
2. If they are skinny but not emaciated, feed them up and keep them on very light exercise to help them build muscle. Body condition score 3-4/9. I presume this means short walks, maybe a short trot if they're feeling up to it, maybe two or three times a week under saddle or lunging.
3. Once they are up to a good weight 5/9 (unless broodmares), gradually ease up to normal work, but make sure to keep up the calories to compensate for the increase in work.
And for weight gain, lots of high quality hay or grass frequently through the day +/- some sort of grain, fermentable forage (beet pulp, etc), and/or oil/fat sources plus a ration balancer as needed. Check and float teeth if needed and make sure deworming is up to date.
I want to make sure I'm not forgetting any major points.