What is weird about this word is not its two senses — a large waterfall and a medical condition of the eye — as they’re both well known, but why one word should have ended up with two such dissimilar meanings.
The origin in both cases is the Greek kataraktes, meaning something that is rushing or swooping down. It’s a derivative of katarassein, from kata– “down” plus arassein “strike, smash”. We have several words in English whose first element comes from kata–, including cataclysm, catapult, catalepsy, catalogue and catastrophe.
One sort of cataract ...
The Greek word became applied to a number of things that rush down, including a swooping bird and a waterfall. It was transferred into Latin in the form cataracta and in that language could refer to a waterfall, a flood-gate or a portcullis (the vertical grated gate to a castle that ran in grooves in the wall and which could be dropped very rapidly to bar entrance). The earliest use in English was to “the cataracts of heaven”, a now obsolete reference to the flood-gates that were supposed to keep back the rain. It was soon after applied to a large waterfall, strictly one in which the water plummets over a precipice; this came from a Latin use of the word to describe the Cataracts of the Nile. English also used it, but rarely, to refer to a portcullis, and sometimes to a window grating.
From about the middle of the sixteenth century, cataract also began to be applied to the medical condition in which the lens of the eye goes progressively opaque. It seems that doctors were using the word as a simile for something that stopped light entering the eye. An older expression for the same condition was web in the eye, so the name was most likely derived from the barred structure of the portcullis or window grating, rather than as a physical barrier. It sounds improbable, but nobody seems to have come up with a better explanation.