MAGNETAR
This question lacks context, it's kind of vague and incomplete. Thereby I'll just provide definitions and some explanations regarding the given question.
WHAT IS A MAGNETAR?
~ A magnetar is basically an ultra-powerful magnet 20-times larger the Sun. It is a type of neutron star with an immensely powerful magnetic field (thousand times stronger than normal neutron stars), so wild and destructive that it can disintegrate planets like Earth if it is near enough.
In fact, a magnetar 50,000 light-years away once erupted a flare and released so much electromagnetic radiation that it reached us affecting the planet's magnetic shield and as a result, it slightly compressed Earth's magnetic field.
Astrophysicists suggest that magnetars originally came from a binary star system - a pair of neutron stars that orbit each other in a very tight system that allow them to interact and exchange materials on the process. Eventually, one of these stars will start to run out of fuel causing the other star to gain all its released energy. Well, the other star isn't ready and stable enough to contain all these unexpected energy coming from its fellow star, it will then spin very rapidly due to the added mass then burst and release out all the materials back before it shatters violently - creating a supernova.
This star spewed out immense amount of energy and lost enough mass for it to explode and become magnetar instead of a blackhole.
INTERESTING FACTS
~ Magnetars are the most magnetic stars in the observable universe. Its magnetic field is super powerful and one thousand trillion stronger than of Earth's magnetic field. In the Milky way galaxy there are 10 magnetars discovered thus far -- the nearest one is "SGR 1806−20" located nearly 10,000 light-years away.
WHAT IS THE DIFFERENCE BETWEEN A MAGNETAR AND A BLACKHOLE?
~ A magnetar is basically a dead star that is believed to came about from a collapsed binary star system, where one star gained so much mass from the other star's fuel only for it to release these materials back and lost enough mass to explode, and finally become a magnetar.
~ A black hole on the other hand existed due to the death of a massive star that collapsed inward because it already ran out all the thermonuclear fuel from its core. If the star is old enough, it will either die for good or collapse and become a black hole.