Magnets attract iron due to the influence of their magnetic field upon iron. Before a piece of iron enters the magnetic field of a magnet, the polarisation of the iron atoms is random. When exposed to the magnetic field, the atoms begin to align their electrons with the flow of the magnetic field, which makes the iron magnetised as well. This, in turn, creates an attraction between the two magnetised objects