Magic is an unstable, supernatural force wielded by members of various species, most notably the Dire Wraiths, to alter reality to a degree.
It can however be defeated with sufficiently advanced science.
The planet Prysmos was a world where magic ruled and science was held in disdain. Under undivulged circumstances however the planet was destroyed with the only known survivor being the extremely powerful and technophobic wizard Merklynn who fled to Earth and used his magic to disguise himself as Garrison Kreiger.
The Wraith Sorcerers could use their magic to perform a variety of feats such as teleportation, telepathy, and the ability to conjure forcefields. Their magic allowed them to infect and assimilate other lifeforms allowing them to assume their form. Though the procedure worked flawlessly on organic lifeforms, an attempt by a Wraith Soldier to assimilate the Autobot Sky Blast turned both the Wraith and the Autobot into an out of control Wraith/Cybertronian hybrid. Once the hybrid's energies caused it to combust, Vekktral wondered if Wraith magic might work better on mechanicals of similar stature to the Wraiths. By studying the hybrid's remains however, Vekktral learned how to stabilize the fusion of Wraith magic and Cybertronian biology and managed to assimilate Ultra Magnus.
A mysterious ore of unknown origin enhanced the natural magic of the Dire Wraiths and they invaded Elonia to try and obtain it despite it being lethal to them. Their invasion was unsuccessful and resulted in the birth of the Space Knights. After the Dire Wraiths had gone to war with the Solstar Order, their science proved superior to the Wraiths' dark magic. At roughly the same time, another group of Wraiths discovered Ore-13 on the planet Earth that had near-identical effects on Wraith magic as the Elonian ore. Its enhancing effect was such that the Wraiths could conceal themselves from a Knight's Energy Analyzer.
In World War II, Kreiger and Sgt. Savage made the acquaintance of the lost Eukarian Centurion and aided him in returning to his ship. When the three arrived at the ruins of the craft, Kreiger noticed the ident on the bridge where the mysterious Talisman had once been and correctly deduced it to be a magical artifact. After an IRON Trooper attack caused the Axalon to teleport away, Kreiger devoted his life to finding the Talisman so as to use its magic to recreate his lost homeworld.
Human science fiction author Arthur C. Clarke wrote that "any sufficiently advanced technology is indistinguishable from magic". Joe Colton dismissed magic as unexplained science prompting Kreiger to quote Clarke's third law as the two discussed the arcane and the Talisman. In reality, Kreiger was trying to turn Colton away from technology and towards magic which he regarded as the true power of the universe but he quickly gave up on this as a lost cause.
After the humans became more aware of the Dire Wraiths, they published several texts regarding magic on the internet. When the command staff of both G.I. Joe and Autobot City were occupied on Cybertron, the Wraiths sought to consolidate their power over Earth and used their magic to alter the biology of several insects, turning them into carriers of a virus. The magic was so unstable however that it burned through the organic hosts.
There was no magic in Microspace leaving the Micronauts unprepared for it when they confronted a duo of Wraith Sorcerers. To thwart the Wraiths' plans, the Micronauts sought out Rom for his expertise on the arcane.
After encountering the Wraiths' magic however, Larissa was able to adjust the personal forcefields of the Micronauts to resist magic. When Rom and the Micronauts confronted the Dire Wraiths and their virus, the magic infused in the latter afforded it a crude sentience. Nonetheless Biotron was able to use technology to synthesize an antidote to the virus. When Baron Karza proposed an alliance to D'rge, his personal forcefields were also calibrated against magic.
On Cybertron, the Iron Ring encountered fierce resistance from Optimus Prime and Scarlett's group as well as the Council of Worlds. In light of this, Kreiger chose to forgo their objective of reaching the metallic planet's core and activate the Talisman then and there. Using his magic he manipulated the planet's energon reserves to transform a portion of the planet's underground into New Prysmos which he claimed would be the staging ground for bringing about the "Age of Magic" across the galaxy.