Magnetars are young neutron stars with the strongest magnetic fields in the Universe. They probe some of the most extreme physical conditions in nature, such as strong field gravity, huge (nuclear) densities and extreme energy densities. The evolution and decay of their ultra-strong magnetic field powers a variety of X-ray bursting activity, ranging from relatively frequent short bursts to very rare and much more energetic giant flares, which can dissipate a good part of their magnetospheric energy and eject plasma at relativistic speeds. Known magnetars are primarily Galactic, slowly spinning isolated neutron stars. Recently a Galactic magnetar was observed to emit a fast radio burst (FRB), solidifying the magnetar-FRB connection. However, despite the lack of clear direct evidence, magnetars have also been argued to play a crucial role in several other types of astrophysical transient events. In particular, a newly born rapidly rotating (with a millisecond initial spin period) magnetar at the center of an exploding massive star was suggested to be the central engine in the strongest cosmic explosions – long-duration gamma-ray bursts and super-luminous supernovae, through its powerful spin-down powered MHD wind, which taps its huge initial rotational energy, releasing it over tens of seconds to days or weeks, respectively. A broadly similar, slightly less extreme magnetar central engine may also operate in some of the more common core-collapse supernovae (CCSN). Moreover, a massive millisecond magnetar may form in an NS-NS merger and could affect the kilonova, short-ray burst, and afterglow emission.