Immunity prevents the Pokémon from being afflicted by poison.
A Pokémon with this Ability will be cured of poison if it is poisoned while in battle (such as if it gains the Ability outside of battle or by an effect like Skill Swap, or is poisoned by a Pokémon with an Ability like Mold Breaker). If the Pokémon with this Ability is poisoned and is holding a Pecha, Lum, or Drash Berry, Immunity will cure the Pokémon of poison before the Berry has a chance to be consumed.
Generation III
If a poisoned Pokémon with Immunity is sent into battle as one of the lead Pokémon or to replace a fainted Pokémon, or gains Immunity due to Trace, it will not be cured of poison until after a Pokémon takes its turn (uses a move, switches out, etc.). It will be cured of poison if it is switched in to replace a switched out Pokémon (including if switched in via Baton Pass).
If a poisoned Pokémon has Immunity as its original Ability but not its current Ability, it will remain poisoned when switched out.
Generation IV
When a poisoned Pokémon with Immunity enters battle, it will be cured of poison.
If a poisoned Pokémon has Immunity as its original Ability but not its current Ability, if it is one of the active Pokémon at the end of the battle or switched out, it will be cured of poison (with no message).
Generation V onward
If a poisoned Pokémon has Immunity as its original Ability but not its current Ability, it will remain poisoned when switched out.
A Pokémon with Immunity can be poisoned by Sunsteel Strike if the attacker has Poison Touch, but will be cured of poison immediately.
Outside of battle
In Generation III and IV, poison will still hurt a Pokémon outside of battle even if it has Immunity.