>Magic Guard will also cancel out Life Orb's HP deduction without negating its power boost.
Source: Bulbapedia/ Life Orb
___
Yes, it was because of Magic Guard. This is a very common strategy with pokes like Alakazam.
It will only take damage from DIRECT attacks, meaning a Pokemon comes at you with the intent to hurt you. So no damage from things like Poison, Burn, Stealth Rocks, etc.
You still receive the 30% boost, so don't worry about that.