What does the expression “to trip the light fantastic” mean and Where does it come from?

The expression “to trip the light fantastic” means: To dance.

In full, the expression is “to trip the light fantastic toe.”

It comes from John Milton’s “L’Allegro” (1632), from the early lines beginning:

Haste thee Nymph and bring with thee Jest and youthful Jollity,

and going on to:

Sport that wrinkled Care derides,
And Laughter holding both his sides.
Come, and trip it as ye go On the light fantastick toe.