I'm going to do some abstract reasoning here. There will be flaws in my logic, but I'm certain that the overall result will be enlightening.
What's the absolute maximum number of fireballs (and people) a mage can toast in a day? Devoting all available slots, a sorcerer can throw out about 30. Each fireball (with radius 20) toasts, what, 50 squares (each with a tightly-packed warrior in it)? That's 1500 warriors in a day.
So you spread your troops out, and do what every sensible army does: have the toughest troops at the back. This serves two purposes: one, they will kill anyone who breaks in front of them, and two, the enemy wastes their resources on green troops who wouldn't make much difference in a battle anyway. If you arrange your troops in staggered lines, with 10 feet between troops, your fireball slinger only fries about 5-8 goons per fireball, bringing fatalities down to 150-240 per day. (And that's in a period of 3 minutes. The clever commander will use either sacrificial soldiers or fire-immune spec-ops forces to draw the mage's firepower and cut him/her down before committing troops.)
Having taken care of the casters with minimal casualties (keyword minimal, not nil), your force engages high-level fighter types and other beasts. In a dungeon, these characters are quite powerful because of the limited room you have to bring up support troops, but on the field of battle you have a good number of archers at your disposal. High-level characters faced with a spread of archers are at a disadvantage, because longbows can fire 700 feet (albeit at horrible penalties) and with that much range to spread out, a clever commander will still avoid spell casualties. Peppering the high-level types with arrows might not bring them down, but it could easily give you the opportunity to bring up tough support troops to meet their attack. (Say creatures with DR 5 to shrug off most arrows in melee, and you can continue a bombardment.)
Even if adventurers can 'port into a critical command area, that's where the most elite troops will be stationed. Not for nothing are the most famous legions of Rome called the Praetorian Guard; they were elite defenders, not attackers, although they certainly could have been used in such a way. Defence is always important to a general; he knows he's the enemy's main target.
Anyway, those examples aside, adventurers can certainly clear the floor around them. The key is, that's a fairly small area. Adventurers don't conquer kingdoms; they simply don't have the sustained mobility and presence needed to control such a large area. Adventurers are spec-ops units in wartime; they attack key locations and take care of other spec-ops groups on the other side.
And here's the real reason you'd still see armed forces in D&D settings: Constabulary. Yes, that's right, the police we have today are a relatively recent invention. If you have a guy with a sword on every street corner, then you have peace in your own cities because nobody's going to try anything. If you rely on four guys with fireball spells to stop pick-pockets, you end up with something from Slayers (read: metropolitan overkill).