One of my favorite objects in the universe are Magnetars. These occur very rarely in space and we have only detected a dozen or so. Still shrouded in mystery, the current running theory as to how these are formed is that through two massive stars in a binary star system that exist in an ultra compact orbit, within the size of the orbit of the earth around the sun. One of the massive stars starts to run out of fuel and transfers its outer layers to its less massive companion, making it rotate faster and faster. This will give the future Magnetar, the less massive star, an extremely powerful magnetic field. Strong enough to suck the iron out of your blood from hundreds and maybe even thousands of miles. At some point the less massive of the stars sheds much of its extra mass, slimming the mass down enough so that a black hole will not be formed. Though there is still much we do not know about Magnetars, it seems a binary star system is a vital part in their formation. *
Want to see a video flying around a Magnetar? Click Here!
(* = Links to sources.)