I was playing a game and a magic guard Pokemon used the move head smash. It did not take any damage, but I wanted to be certain.
Damage caused by entry hazards (such as Spikes) and recoil and crash damage is prevented, except recoil damage from Struggle. Magic Guard will also prevent Life Orb's HP deduction without negating its power boost. Damage from confusion still occurs.
source