If you're hit by an energy-based projectile (fire, lasers, etc.) while using the Magnet, you'll recover health. What it can and can't absorb varies from game to game. In Melee, you can't absorb Master Hand's bullets, while you can in Smash and Brawl. In Melee, you can absorb the Ice Climbers' Ice Shot, but no longer in Brawl.