|MadSci Network: Physics|
Heat is a kind of complicated concept. The temperature or heat content of a gas varies as the velocity of the atoms. The faster they are moving the higher the temperature. If the atoms of the gas are neutral i.e. not ionized, a magnetic field will have essentially no effect at all. Magnetic fields act on other magnets or on electrical currents. If the atoms are very hot, like those near the sun, then they become ionized. When such an atom moves it creates a current and then a strong magnetic field can have a big effect. So the answer to your question is yes a magnetic field can trap the heat in a gas but only if the gas is ionized.
Try the links in the MadSci Library for more information on Physics.