Abu Sa’d al-’Ala’ ibn Sahl was a mathematician in late 10th Century Persia, working for the hugely powerful Abbasid caliphate and probably based in Baghdad. He understood the mathematics of refraction, at least six hundred years before Dutchman Willebrord Snellius wrote it all down and eventually gave the sine law of refraction his name. Snellius’ ancestors in Europe, in Ibn Sahl’s time, were in the middle of the Dark Ages, waiting patiently for the Renaissance just three or four hundred years away.
Refraction—the bending of a wave's ray-path due to a change in velocity—had been studied by the Egyptian astronomer Ptolemy in the second century, but he was unable to figure out the mathematics fully. It’s not known whether Ibn Sahl knew of this work, but Ptolemy’s Optics was certainly translated into Arabic, so it seems likely that he did. There wasn’t, after all, that much to read in those days.
The key figure from his work On Burning Mirrors and Lenses is shown here. I have cropped out part of the figure (see the whole thing. I redrew the diagram, and added some annotation to show how it relates to the usual formulation of Snell's law. The ratio of the lengths of the hypotenuses AB to DB is equal to the reciprocal of the ratio of the refractive indices of the materials on either side of the vertical line. Phew!
Ibn Sahl’s work was brought much further along by one of his successors, Ibn Haitham, widely considered to be the founding father of optics. He was the first person to make a pinhole camera, and thereby prove that light travelled in straight lines.