And those who were seen dancing were thought to be insane by those who could not hear the music.
Behavior that looks absurd from outside can make perfect sense from within, because the observer is missing something the dancer perceives. The madness lies in the gap between two people's information, not in the dancer. Whoever judges only by what is visible, the flailing limbs and the odd movements, will misread it, because the music is the whole reason for the dance.
The thought fits Nietzsche's wider outlook: his suspicion of the herd, his insistence that people should shape their own values rather than borrow them, and his habit of using dance as an image of lightness and vitality. Still, the line is usually pinned on him without a clear source in his writings, and it may be a later paraphrase or a proverb, so it is safest to treat the attribution as uncertain.
Today, imagine someone who leaves a steady office job to train as a carpenter. Relatives call it reckless, and arguing rarely helps because they can't hear what draws this person. A kinder response is to accept that the music is private, keep dancing carefully, and look for the few people who can hear it too.