There seems to be a great deal of confusion in the answers.
Robotic vehicles and devices with multiple legs would be useful in niche roles. You could imagine a robotic spider capable of climbing walls, for example. Larger robotic vehicles to support troop movement, act as squad level porters and even weapons platforms may or may not have legs. Boston Robotics has been developing walking machines for the role, like "Big Dog", but other vendors have robotized 6X6 ATV chassis to do the same thing.
Locheed Martin Robot
Looking at the pictures, you can see the wheeled robot would be faster, is certainly cheaper and less complex, and this particular model is probably amphibious. The Big Dog, not so much
Legged vehicles have one advantage over wheels and tracks, in that they can clear a greater vertical "step hight". Driving your car into a curb or the low concrete barricades in parking lots demonstrates the issue, Armoured fighting vehicles have much better suspensions, larger wheels or tracks and a greater power to weight ratio and even then only clear about a one metre vertical "step"
The Israeli "Combat Guard" can clear more than a metre step because it has 52" wheels. I don't want to be the guy changing the tire, though
Mecha, as generally described, are manned fighting vehicles which are substitutes for AFV's, self propelled artillery etc. Although different authors have different ideas about this, the general model tends to much greater than human size, and generally carrying a massive weapons loadout.
At these scales, the objections of weight, ground pressure and mechanical complexity are very valid, and I would see something like this falling under a hail of artillery, guided missile, air attack and cannon fire delivered by tanks. At much smaller sizes, a Mecha might have an advantage over conventional AFV's due to the ability to overcome vertical obstacles (the 1 metre "step hight"). If the ground is excessively broken and presents an obstacle to conventional wheeled or tracked vehicles, then a walking machine will have the ability to carry more supplies and munitions than a dismounted infantry soldier.
You would have to question why at that point no one is flying in by helicopter or using fast air to suppress. Coalition forces in Afghanistan worked in extremely mountainous terrain in the Sha-i-kot region in the early part of the campaign, and generally were ferried in by helicopter, and supported by helicopter gunships, fast air and carried mortars and machine-guns for their organic fire support. Marginal Terrain Vehicles like the BV-206 and militarized ATV's were used as well to provide local mobility.
Infantry arrive in rugged terrain
BV-206 Marginal Terrain Vehicle loaded into Chinook in Afghanistan