Yes! Although, not in any official capacities like horses, dogs, or mules, cats did often have a place on ships, in barracks, and as companions for those serving in the military. Unofficially, cats were often welcomed aboard ships to help with rodent control and similarly in barracks and military field offices. A good ratter could help preserve often precious food stores, help in preventing the spread of diseases, and keep rats or mice from chewing through ropes and wiring. However, many of us will be most familiar with cats that served as mascots and companions.
Providing stress relief and a bit of fun in tense situations in the main job of any mascot, like this aircraft carrier cat.
Often pets and mascots were adopted along the way by soldiers and sailors who found an abandoned cat or kitten.
Finally, cats have a way of breaking up the monotony of any long day. Their services though not always considered heroic were certainly great contributions to those around them who benefitted from their companionship, mouser skills, and entertainment.