Marcus Aurelius, in his Meditations (book V, section 20), written in Greek as private notes in the AD 170s. The famous English wording is Gregory Hays's translation, published in 2002. Older translations say the same thing more slowly: George Long's of 1862 ends “that which is an obstacle on the road helps us on this road.”
What it means
An obstacle is also material to work with. The mind can turn what blocks it into the next thing to act on, so the problem in front of you becomes the route forward rather than the end of it.
Where it comes from
The section starts with other people. Marcus says that, in so far as he must do good to people and put up with them, they are close to him; but when some make themselves obstacles to what he should be doing, they become as indifferent to him as the sun, the wind or a wild animal. They can hinder his actions, but not his intentions or his disposition, because the mind adapts.
In George Long's translation: “for the mind converts and changes every hindrance to its activity into an aid; and so that which is a hindrance is made a furtherance to an act; and that which is an obstacle on the road helps us on this road.” Gregory Hays's version, quoted by Wikiquote, compresses the last part into the two short sentences now printed everywhere: “The impediment to action advances action. What stands in the way becomes the way.”