Polymorph traps do not instantaneously polymorph you; instead they start a short timer during which the player has time to either stop the polymorph from occurring (through healing potions, or prayer, or some other decently common consumable) or put on a ring of polymorph control or amulet of unchanging. However, magic resistance no longer protects against this effect.