 As revealed in the fifth book, magic is another type of energy, like its counterparts kinetic energy and light energy (among others)
It is subject (like every other type of energy) to the law that "Energy cannot be destroyed, only converted into another form.