A magnetar (a contraction of magnetic star) is a neutron star with an ultra-strong magnetic field. At ~1015 gauss, the magnetic field is a thousand trillion times stronger than the Earth's, and between 100 and 1,000 times stronger than that of a radio pulsar, making them the most magnetic objects known.
They are formed in the same way as all neutron stars, through the core-collapse of a massive star in a supernova explosion. It is not entirely clear what conditions cause a magnetar to be created instead of an ordinary neutron star or pulsar, but in order to achieve such strong magnetic fields, some theories suggest the neutron star must initially rotate between 100 and 1,000 times per second.
The idea of a magnetar was first proposed in 1987 and used to successfully explain soft gamma repeaters (SGR) in 1992. However, few considered it seriously until 6 years later when the detection of pulsations and the measurement of the spin-down rate of a SGR suggested that it was a neutron star with a magnetic field strength of 8 × 1014 gauss.
Since that time, both SGRs and anomalous X-ray pulsars have been explained successfully by the magnetar model, with the decay of the magnetic field powering the emission of X-rays and gamma rays. However, it appears that magnetars are only X-ray bright for a short period of time since their pulse periods are clustered between 6 and 12 seconds. If they remained active for an extended period of time, we should also see magnetars with pulse periods of tens of seconds or longer.
In 2006 astronomers discovered that the magnetar XTE J1810-197 was visible as a radio pulsar with an incredibly flat spectrum. Indeed this magnetar was visible all the way from radio to mm wavelengths and had a rapidly evolving pulse period. Normally radio pulsars have very stable pulse periods, or switch between a couple of different modes. The magnetar XTE 1810-197's radio pulse varied tremendously from day to day as it gradually faded.