That crusty stuff you wipe from the corner of your eye every morning doesn't serve a purpose - it's just waste. A mixture of sweat, oil, and tears, the lack of eyelash movement while asleep lets it accumulate instead of being wiped away.
The eyelashes are protectors - but the lids moving over the eye also wipe away tears/fluid that continuously nourishes the cornea. As you sleep it pools in the little dip at the corner instead. If you're ill and secretion is increased around the eye, you might even wake up with stuck eyelids!