The oldest argument against SF is both the shallowest and the profoundest: the assertion that SF, like all fantasy, is escapist. […] If it’s worth answering, the best answer is given by Tolkien, author, critic, and scholar. Yes, he said, fantasy is escapist, and that is its glory. If a soldier is imprisoned by the enemy, don’t we consider it his duty to escape? The moneylenders, the know-nothings, the authoritarians have us all in prison; if we value the freedom of the mind and soul, if we’re partisans of liberty, then it’s our plain duty to escape, and to take as many people with us as we can.
Ursula K. Le Guin (1929-2018) American writer
“Escape Routes,” Galaxy (Dec 1974)
Reprinted in The Language of the Night (1979).
Though Le Guin makes it clear it's a paraphrase, the main body of this passage is often misrepresented as an actual quotation from J. R. R. Tolkien (and with an exclamation point on the final sentence). It was, instead, inspired by Tolkien's comments on escapism in "On Fairy-Stories" (1939).
More discussion on this quotation: Not a Tolkien quote: "Fantasy is escapist, and that is its glory" - thetolkienist.com