When a ferromagnet is heated to a significantly high temperature, it loses its magnetism. At temperatures above what is called the Curie point, the magnet will be completely demagnetized. For iron magnets, this point or temperature is 1043 degrees Kelvin.
When a magnet is heated, the high temperature increases the kinetic energy of its atoms, causing the lose of the magnet's alignment.
However, its magnetism can be re-established through the use of a permanent magnet or by a solenoid. Although magnets can also lose some magnetism at temperatures that are lower than the Curie temperature, they will regain it as they cool down to room temperature.
Besides iron, other ferromagnetic materials are nickel, cobalt and a few rare earth metals. These other materials also will lose their magnetism if subjected to temperatures above their Curie temperature.