Usually there is an LED and a photo transistor, embedded in the
same component. The package is usually a DIL with either 6 pins or
four, for single devices.
The idea is, that a signal is sent to the LED and picked up with
the transistor, held in a sealed encapulation.
The only connection between the two is LIGHT, no other
electrical connection.
So it prodides ultimate isolation to prevent stray voltages
getting into sensitive areas.
They are used in switched mode power supplies, to provide a feed
back signal between the Low voltage side and the high voltage
side.
They are also used in home telephones, to send the 50vac ring
signal to the electronic warbler circuit. To isolate the user from
any high voltage.
(I have known phones suffering lightning strikes, to have the
top blown off the OptoIsolator!).