Is it ok to quote a line from a fantasy book in a scientific paper?
It might well sound unprofessional, but most people would forgive you. If it "connects" people to your topic it might be worth the risk. But Tolkien, in particular, is best known by only a portion of the adult audience. The same is true for Frank Herbert and Robert Heinlein. 

But think about what it adds to your work. If it is fairly positive, don't hesitate. If it adds very little, then give it up. 

If the work is strong in general then it won't even matter if the cognoscenti roll their eyes a bit.