the US Army can cook food, provide medical care, transport goods and people across the world, engage in large construction project, conduct law enforcement operations, provide maintenance for a wide variety of a équipement and structures, provide electrical power, etc. all things that can be done by other organizations. what does other organizations can't do however, is provide national defense.
Of course they can. All you'd have to do is order them to.
The fact that they would not SUCCEED in doing so -- and the fact that you'd have no way of dealing with them if/when they refuse to do so -- is the reason why militaries were created in the first place. If your country is under attack and you order the tax collectors to go out and fight the attackers, they'll simply be slaughtered; they have no guns, no combat training, no tanks, no planes. A military organization is created to serve that societal need, because war is a savage business and is best kept isolated from civilized life.
If a someone OTHER than the military can serve that need, that society will not have a military. At least insofar as space combat, the Federation appears to be such a society.
It's similar to the way modern societies created police forces to enforce the laws instead of leaving that in the hands of knights, mercenaries, armed noblemen or specialized local soldiers. It was a role societies no longer needed militaries to fill, so new entities were created to fill them (though not always; Gendarmaries still exist in France).