In battle
Magic Guard prevents the Pokémon from receiving indirect damage, but does not prevent it from becoming afflicted by statuses that would deal such damage. Additional effects, such as being trapped by binding moves or having its Attack reduced by burn, are not prevented even though their damage is.
Magic Guard prevents damage caused by effects including weather, poison and burn, effects like Curse and Leech Seed, entry hazards, recoil (except from Struggle), crash damage, and damage from using Mind Blown. Magic Guard prevents the damage inflicted by a Life Orb, but the holder still gains the power boost. Damage from confusion still occurs.
Magic Guard does not prevent direct modification of a Pokémon's HP through means other than damage, such as by Pain Split, Belly Drum, Substitute, or a Ghost type cutting its own HP to use Curse. Moves that cause the user to faint, Destiny Bond, and Perish Song can still cause a Pokémon with Magic Guard to faint.
Generation IV
If a Pokémon with Magic Guard is paralyzed, it cannot be fully paralyzed, although its Speed is still reduced. A Pokémon with Magic Guard cannot be poisoned by Toxic Spikes.
Generation V onward
Magic Guard no longer grants immunity to being fully paralyzed and no longer prevents poisoning from Toxic Spikes (but it still prevents poison damage).
Outside of battle
Magic Guard has no effect outside of battle. This means a poisoned Pokémon with Magic Guard will still take damage in the field in Generation IV (but not later generations, because poison no longer causes damage in the field starting in Generation V).