Sadly, war is dramatic and a pretty big part of many RPG worlds - so it's not unusual for PCs to get involved in military actions and campaigns. This can lead to all sorts of problems for a GM:
- Obviously, running a combat encounter with dozens of NPCs involved can be difficult - much less hundreds or thousands!
- In reality, soldiers spend most of their time bored, except for brief periods of excitement - not great for PCs.
- Many of the dangers faced by soldiers (especially in modern settings) come from threats that PCs may have little protection from or control over (i.e. artillery, bombs, gas, etc).
- Unless the PCs have high rank, realistically they'd have to follow orders and depending on the scenario may have little control or decision-making - again, not fun for PCs.
Small Unit Actions
In most worlds, warfare will likely involved a lot of small unit fights, in addition to big battles and sieges. Raids, recon, scouting would all be great missions for your merry band of PCs - and will set up more manageable combats for them to take part in. These are also the kind of missions that allow more latitude for the PCs to decide how and what to do, and to feel like they're accomplishing something useful in the bigger picture.
"Special operations" is an especially fruitful area for PCs, whether under that name in your world or not. Just reading about some of the special ops missions that have occurred from WWII onwards should give you all sorts of ideas, even if your game takes place in a fantasy world. Examples: train local rebels, snatch an enemy leader, blow up a key bridge, dump a powerful ring into a volcano, find the magic [insert item] to defeat the terrible enemy [insert creature], observe enemies in order to direct bombing/artillery up on them, etc.
Battling with Battles
Still, big battles are going to occur in most wars - and PCs will typically want to be involved somehow. It's what heroes do, right?
Obviously, using RPG rules to handle any sort of large battle won't work. One way to handle allowing your PCs to participate in a battle is to let each make a few relevant skill checks, perhaps modified based on what they say they want to do in the battle. If one wants to engage in reckless heroics, perhaps they have a negative modifier to their skills, and a poor roll results in wounding, death or capture. A captured PC is a great hook for another gaming session ("Now we have to go rescue Bob again...")
Another option is to try to find some small unit "part" of the larger battle that makes sense. For example, if the PCs are defending during a siege, perhaps they are tasked with defending a single tower as enemies attempt to gain entry in various ways. Here's another idea - many sieges involved lots of tunneling. Perhaps the PCs are sent down into a tunnel to try to head off the enemy's tunnel - leading to a nasty little fight in the dark...
Sometimes even a field battle can have a smaller struggle suitable for the PCs to make their present felt, without an overwhelming number of PCs for the GM to deal with. Hougoumont at the battle of Waterloo comes to mind (although probably a bit too big for this example) - in which a smaller battle within a battle took place in a walled farm compound. Or perhaps the PCs need to hold out against mobs of enemies for some period of time before rescuing forces can arrive.
Another example would be the rebel mission to Endor in Return of the Jedi - a small force is sent to take out an Imperial structure in order to affect the course of a much larger battle happening overhead.
Espionage and Resistance
Another theme that lends itself well to PCs is espionage. Imagine the PCs infiltrating the enemy camp, to steal information, sabotage or assassinate. Any fights the develop would logically involve small numbers, or would revolve around the PCs trying to escape. This is also a great way for more "social" characters to contribute.
Resistance is another related theme to espionage - often in the past resistance movements have been assisted by spies and special operations. My alien invasion campaign was focused around the idea of the PCs operating as an autonomous resistance cell - think along the lines of the TV series "V" or the movie "Red Dawn." Part of what I liked about this campaign was giving the PCs access to human military tech and letting them figure out ways to use it against more advanced alien tech. Sometimes you just need bigger guns :)
Another option is to allow the PCs to take direct command of the battle, and resolve the battle using the tabletop wargame rules of your choice. Depending on your campaign, you can even convert your PC characters into units on the board - probably something for a cinematic fantasy campaign with powerful, magical characters. I remember the old Battlesystem rules let you convert AD&D characters into units on the battlefield.
This approach works well if the PCs are actual commanders of armies/units in the game world. If your PCs are wandering heroes saving the occasional village from bands of goblins... you'll need to come up with a good reason why the king would decide to put them in charge of his army!
Just Getting Pulled In
Sometimes the PCs just get pulled into larger events as they pursue their own agenda. The plot of Last of the Mohicans - the heroes end up involved in the siege of Fort William Henry despite having little interest in the war going on. One of my favorite movies and it has tons of little bits that could be used - the siege, the conflict between the heroes and the commander of the fort, the ambush on the retreating survivors, the canoe chase...