What does it mean to invest for the long term and why is it so important?

You’ve heard it said that you have to be invested for the long run; but what does that mean exactly, and why is it so important?