Both gravity and magnetism are types of forces.
One is giving rise to a gravitational force or pull and other give rise to magnetism.
Since,
force x displacement =work
work done here is stored as energy.
Both gravity and magnetism can only give rise to a force.. Can't do a work.. So not an energy form.
Therefore both gravity and magnetism are not considered as a form of energy