When someone makes a spectacle of themselves, it means that they drew attention to themselves by behaving in a ridiculous way in public. Spectacles are glasses. The joke is playing on the phrase "made a spectacle of himself" because it could be literal, as in, the optician turned himself into spectacles, or figurative. 
The optician fell into the lens grinding machine and made a spectacle of himself .