Only takes damage from attacks.
Magic Guard is an ability that prevents the Pokémon from taking damage from indirect sources. This means that the Pokémon with Magic Guard will not take damage from status conditions like poison or burn, as well as environmental effects like hail or sandstorm. Additionally, they will not take damage from recoil moves or entry hazards like Stealth Rock.
This is super helpful when in a battle with a Pokémon that relies on status conditions or entry hazards to wear down opponents - like Toxic Spikes.