Magnesium conducts electricity, mainly because it is a metallic element. Other similar metals that also conduct electricity are sodium and aluminum.
A material is considered a conductor or insulator based on how easily current can flow through them. Solid metals, in general, are the best conductors of electricity. Electrons become delocalized in metals due to the fact that they have few valence electrons, usually one to three. This property allows any new electrons introduced to the system, like in the form of electricity, to rapidly move from one atom to the next. Most nonmetals are insulators, except in special forms, like carbon as graphite.