Assuming you're taking about the effects of fasting, there are exceptions to fasting. You do not have to fast if:
(Probably forgetting a few things here)
Military campaigns count as traveling and as an unstable condition so a soldier would be exempt from fasting, but can fast if he still desires to do so.