Magnet Pull prevents adjacent Steel-type opponents from fleeing (including Teleport) or switching out as long as the user remains in battle. However, if a Pokémon with Magnet Pull switches in, Steel-type opponents that decided to switch out at the beginning of that turn but have not yet moved will still switch out.
If a wild Pokémon has Magnet Pull and the player's Steel-type Pokémon faints, if the player attempts to flee instead of sending out another Pokémon, they are unaffected by Magnet Pull.
Magnet Pull does not affect allies.
Generation VI onward
Ghost-type Pokémon are now immune to Magnet Pull (even if they are also Steel-type).
Outside of battle
From Pokémon Emerald onwards, if a Pokémon with Magnet Pull is in the first place in the party (even if fainted), then there is a 50% chance the game will force an encounter with a Steel-type Pokémon, if one is possible.