Imagine rain falling on a landscape in which there are hills and valleys. A small lake may form in a hollow half way up the side of a hill. The water doesn't know that it's half way up the hillside, so it stays where it is. If a storm blows, or if there's an earthquake, the water in the hollow may be shaken out, and descend the hillside to the valley below. By shaking things up, you enable it to find a lower-energy and more stable state, overcoming the small obstacle that previously held it in place.
With the iron filings, the effect is similar. You need to give the filings a bit of a shake to enable them to find their way to the lower-energy state, overcoming the friction that otherwise kept them where they were. Of course, if you shake it too much, they will find an even lower-energy state where they all move close to the poles of the magnet.