Magic in the DC Universe has multiple points of access, but a single point of origin. Its primary source was the Godwave, a burst of primal energy related to the Source and the Source Wall. It was believed to be the catalyst for magical energy permeating the Multiverse. 1
In the previous DC Continuities (Pre-Crisis, Silver Age, Post-Crisis, Modern Age) Magic was a Universal power accessible to those who understood it and can control it via technology, ancient lore, ritual/theurgy, or through direct manipulation of the magical energy itself. In the early universe, many races could manipulate magical energy and often employed its darkest chaotic aspects in their rituals.
Three and a half billion years ago a humanoid race from the world of Maltus sought to bring order to the stars. An offshoot of the race became known as the Guardians of the Universe. They sought to remove magic from the universe, and laid siege to the necromantic forces of the cosmos. The war was costly on both sides. The last to fall was the powerful Empire of Tears, finally subdued by the Guardians on the tombworld of Ysmault.
The tombworld of Ysmault, the demonic inhabitants of Ysmault and their final conflict against the Guardians agents, the robotic Manhunters.
Despite magic being a fundamental aspect of the Universe, the Guardians of the Universe (later known as the Guardians of Oa) tried to bind and dispel this chaotic energy in an attempt to make the universe more orderly. It was partially successful and allowed for the ascension of reason and scientific exploration.
This collected magical energy existed as the Starheart. The Guardians compressed it an flung it to the far corners of the Universe. Eventually, a fragment of it found its way to Earth becoming the ring and lantern of the Golden Age Green Lantern.2
Despite the tampering of the Guardians, magical energies still existed in the Universe and many species would eventually tap into them despite their efforts. The Endless are examples of magical Universal forces beyond the ability of the Guardians to regulate or control.
The Endless are as old as the concepts that they represent, and although exact ages for any of them are unavailable (only relative ones are), they are known to have at least existed for far longer than life on Earth has. This is possible because of the existence of many advanced alien civilizations from long before the creation of the earth.
Energies from parallel realms of existence such as Heaven or Hell leak into the Orrey of Worlds allowing demonic or angelic beings to utilize magic. Beings such as Etrigan the Demon, Witchfire, Blue Devil, Felix Faust and Raven manipulate dark otherworldly and other-dimensional energies. Angels, the Spectre and John Constantine have been known to tap into light-sided Enochian energies. Two powerful forces of extra-dimensional magic were the Lords of Order and the Lords of Chaos.
Occult artifacts can also tap into otherworldly energies linked to powerful elemental forces such as the Green, The Red, the Grey, the Clear and the Rot. Such artifacts include helmets of Doctor Fate and the B'Wana Beast, Vixen's Tantu totem, Ibis the Invincible's Ibis-stick, Sargon the Sorcerer's Ruby of Life, and Bloodwynd's blood gem.
The Helm of Nabu used by Doctor Fate, the Tantu Totem used by Vixen and Sargon the Sorcerer's Ruby of Life.
Many magic users on Earth are either genetically predisposed to magic and are called Homo Magi. This blessing of their bloodline allows them to manipulate powerful magical energies whose source is unknown. Homo magi first appeared in Justice League of America #164 (March 1979), and were created by Gerry Conway and Dick Dillin.
Not all magic-using humans are Homo Magi. Some are blood relatives to the Fae, who were extradimensional beings whose magical affinity was far greater than Homo Sapiens and they pass this affinity to their descendants such as Timothy Hunter, Morgaine le Fey and Doctor Occult. A number of Humans draw their power from elemental forces such as Swamp Thing, Naiad, the Hat and Solomon Grundy.
Other dimensional energies can be used to change or empower Homo Sapiens creating god-like beings, including the Wizard Shazam, Captain Marvel, the Enchantress and Extraño. Gods or god-like beings are considered to be using a divine power and draw part of their energy from worship and part from The Source, a primal fundamental background energy of the Multiverse.
The Source Wall, the fundamental barrier to the edge of the Multiverse. It is here that beings who attempt to understand the true nature of the Universe (by using the Anti-Life Equation, for example) are bound forever. It is believed this barrier is the source of all that there is, including magic in the Multiverse.
On the DC Earth, Atlantis is often considered the undisputed center of magical power on Earth. The ancient Atlanteans were powerful magic users and used it to rule the world for millennia circa 45,000 BC. (See: Arion of Atlantis, also see: Ahri-ahn)
In the DC Universe, the Homo magi originated on the lost continent of Atlantis. The continent was a focal point for unharnessed magical energies (wild magic), and the local Homo sapiens evolved into Homo sapiens magi as a result of their exposure to these energies. Upon the fall of Atlantis, people who carried the predisposition for magic were scattered to the four winds. Today, every human being capable of casting spells is a descendant of the Atlantean "Homo magi."
1: Whether this is still true in the New DC Multiverse has not been determined.
2: Ref: Wallace, Dan (2008), "Green Lantern's Power Ring", in Dougall, Alastair, The DC Comics Encyclopedia, New York: Dorling Kindersley, p. 92**