A magnetic storm was a spatial phenomenon that posed a navigational hazard in the early days of space travel. At that time, the impulse engines were not powerful enough to resist the effects of such storms, and a ship encountering one could be swept off course.
Magnetic storms could also occur on the surface of some planets. On Rigel XII, they were accompanied by or cause extremely powerful sandstorms. Such a storm nearly claimed the life of Eve McHuron in 2266; only lithium miner Ben Childress' determined search located her. (TOS: "Mudd's Women")
In 2267, the USS Enterprise encountered a magnetic storm at the Halkan homeworld, while James Kirk and his landing party were on the surface conducting negotiations. The storm was reported by Spock to be a "standard ion type, but quite violent and unpredictable." During the beam up to the ship, interference caused by transporting through a magnetic storm caused the crew to transport to an alternate mirror universe. (TOS: "Mirror, Mirror")
In 2268, the Providers wanted to make the crew of the Enterprise thralls on Triskelion destroy the ship, and let its destruction appear as being caused by a magnetic storm. (TOS: "The Gamesters of Triskelion")
While attempting to extract their personnel from the Mokra homeworld in 2372, the USS Voyager hid within a large magnetic storm over the planet's northern magnetic pole to avoid the Mokra's phased ion cannons. (VOY: "Resistance")