I did a little bit of Internet sleuthing about the history behind this quote, and it is most frequently attributed to Sufi philosophers.
The most popular fable imported by the West is a story of a king who asked his wisemen to inscribe a ring with a saying that would make him happy when he was sad. The wisemen settled on the phrase, "This too shall pass," but the king realized in time that the saying was a double-edged sword, as it also portended the end of all good things as well.
That which gives us hope can, by the same token, humble us in our moments of triumph. Regardless of whether you are in darkness or in light, know that this too shall pass. The moments of darkness will recede. And remember to relish the moments of light.