Link can use them to climb metal walls and attach himself to magnetic platforms and cranes, particularly in the Goron dungeon. Certain switches can also be toggled with the magnetic gloves.
Pressing the button activates the magnetic gloves, one polarity at a time. Pressing the equivalent of the R trigger switches polarity instantly. The magnetic charge is active for as long as you hold down the button.
A strong magnetic pulse is sent out. Items of opposite polarity are attracted to it, and if they're mobile, they'll head toward Link. If they're stationary, Link will be dragged toward them. Items of opposite polarity will be repelled away from Link, or push him away, depending on whether or not they're stationary.