  We utilize an exact quantum calculation to explore axion emission from
electrons and protons in the presence of the strong magnetic field of
magnetars. The axion is emitted via transitions between the Landau levels
generated by the strong magnetic field. The luminosity of axions emitted by
protons is shown to be much larger than that of electrons and becomes stronger
with increasing matter density. Cooling by axion emission is shown to be much
larger than neutrino cooling by the Urca processes. Consequently, axion
emission in the crust may significantly contribute to the cooling of magnetars.
In the high-density core, however, it may cause heating of the magnetar.
