Imaginary languages are now par for the course in fantasy literature: sometimes called something like 'the old tongue' or 'the ancient language', sometimes the languages of different types of being or of people living in different places. In many cases these languages aren't developed beyond a few words (e.g. in The Wheel of Time, The Chronicles of Thomas Covenant, or A Song of Ice and Fire), but some authors have actually constructed whole languages for the purposes of a single work of fiction: e.g. the language of Klingon was invented for Star Trek, and for the Game of Thrones TV series, a linguistics expert was employed to create the Valyrian and Dothraki languages. I suspect Christopher Paolini has invented more than just the phrases listed at the end of each book for his elvish and dwarvish tongues, but I haven't seen this confirmed.
Tolkien was already devising his own languages as a young boy, and continued to do so throughout his life, so it makes sense that he might have been the first to do so in fiction. Can anyone confirm this?
Follow-up question: was Tolkien the first person to write fiction with any words invented in an imaginary language, let alone the whole language constructed? I don't count things like Lewis Carroll's nonsense words in 'Jabberwocky', since they were intended to be (and some have since become) words in the existing language of English.