The 2007 paper The challenges of landing on Mars gives a decent introduction to the subject, and the evolution of Mars landing methods.
- First generation: Viking. Propulsive landing, lander on legs.
The key challenges with a legged system revolve around the fact that in order to make the lander safe for landing in regions with large rocks the legs must either be made long or the belly of the lander must be made very strong. Neither solution is attractive, resulting in either a top heavy lander incapable of landing on sloped terrain, or a significant amount of belly reinforcement carried along for the remote chance of incurring a direct rock strike. A second major challenge of the legged landing architecture is that of safe engine cut-off.
- Second generation: Pathfinder and MER, airbags. Specifically done for rovers. Stationary landers continued to use propulsive landing (InSight, Phoenix and the failed Mars Polar Lander).
Advantage: reduced cost (landing systems are simpler), improved landing robustness.
Disadvantage:
The Sojourner rover and the Spirit and Opportunity rovers all experienced their most difficult and threatening mobility condition as they made their way off of their landers.
- Third generation: MSL, skycrane
The third generation landing system being deveIoped for the MSL mission is being designed to directly address all of the main challenges present in the first and second generation landing system while completely eliminating the challenge of egress.
The Skycrane Landing System (SLS) eliminates the use of a dedicated touchdown system by directly placing the rover onto the surface of Mars, wheels first.
At 900 kg, Curiosity and Perseverance are too large to use air bags. Luna 25 is in the same weight bracket, the Chandrayaan-2 lander is about 600 kg, which is slightly more than the ~530 kg of the MER landers.
Airbags were considered for MSL:

As you can see, that's a lot of air bags.
another source that confirms air bags were not viable for MSL:
But the Mars Science Lab (MSL) team quickly determined that airbags would not be a viable solution for something as big as Curiosity. An airbag system designed to accommodate the size and mass of Curiosity would be very large and heavy and significantly different from the Pathfinder and MER designs. In addition, egress from the top of the deflated airbags and lander platform is a complex and tricky maneuver; it would be even more complex with an airbag design large enough for Curiosity.
Edit: added more information on the tradeoffs, and my initial claim about airbags being more complex was incorrect.
Why were airbags used for Pathfinder/MER
The airbag system was used for Pathfinder and MER because it was projected to be less expensive than a traditional propulsive landing:
They basically looked at the two options and said, Well, propulsion...that's the old way of doing business. You guys will never get this job done if you do it that way. It's too expensive."
The landing software can be simpler with an airbag system:
The Mars Pathfinder airbag system was designed to protect the lander regardless of its orientation upon impact with the surface of the planet. The system also was designed to handle lateral movement as well as vertical descent.
The Pathfinder and MSR missions had no way to scan the terrain and avoid problems. All they had was an altimeter that could fire the retrorockets and separate the lander from the retrorocket package.
Past Mars Mission utilized radio-based approach navigation, no control of the lift vector during entry, a single stage parachute, and hazard tolerance only to the extent that either airbags or landing struts are utilized. There was no hazard detection/avoidance capability.
The landing rockets can be simple solid rockets, without much accuracy. No vernier thrusters are needed.
The brief firing of the solid rocket motors at an altitude of 80-100 meters is intended to essentially bring the downward movement of the lander to a halt some 12 meters (±10 m) above the surface. The bridle separating the lander and heatshield is then cut in the lander, resulting in the backshell driving up and into the parachute under the residual impulse of the rockets, while the lander, encased in airbags, falls to the surface.
Because it is possible that the backshell could be at a small angle at the moment that the rockets fire, the rocket impulse may impart a large lateral velocity to the lander/airbag combination. In fact the impact could be as high as 25 m/sec (56 mph) at a 30 deg grazing angle with the terrain.
The lander was designed to right itself after a landing in any orientation (i.e. you don't have to care about that during the landing, but it requires extra hardware to rectify the orientation after landing.
Tradeoffs
The choice of landing system is a matter of tradeoffs:
airbags have disadvantages. The bags and their supporting hardware are
themselves heavy, which reduces the amount of scientific equipment a
lander can carry. And for precision landings, legs generally do a
better job. Spirit bounced 28 times before finally settling to a stop
300 yards from its point of first impact.
On the other hand, airbags aren’t bothered by large rocks that might
tip a legged lander. On the other other hand, spherical airbags can
roll into a deep crater from which a rover would never escape.
Spirit and Opportunity hit the ground hard enough that they experienced a deceleration of 19g. Curiosity (and propulsive landings in general) made a much softer landing.
For the next generation, they wanted to make a more precise landing:
Scientists also expect to set it down with pinpoint precision to maximize their chances of finding interesting geology.