An optoisolator, a.k.a. optocoupler (opto), is a device that sends a signal from its input to its output using a beam of light. They are typically used when the input and output must be isolated electrically from each other. Generally this is because one of the devices at either end of the opto can’t handle the voltage at the other end. e.g., an input signal of 100 volts that must be detected by an Arduino that can only accept 5 volts. In this case, the opto offers a safer voltage interface than using a voltage divider. Voltage dividers mean that one leg of the input voltage must be connected to the Arduino and this can lead to an unsafe circuit. Using an opto means that the only connection between the input and output is a beam of light inside the opto.
Optocouplers are rated by their isolation voltage. e.g., the isolation voltage for an inexpensive and common 4N26 optocoupler is 5000 volts! This means that the input voltage in the previous paragraph would have to be greater than 5000V before damage would be caused to the Arduino.
A useful application for an optocoupler is in driving an output to a higher voltage than an Arduino can handle. A 4N26 opto can be controlled by a 5V-tolerant Arduino and can switch up to 70 volts. This means that if you want to control e.g., a PLC (Programmable Logic Controller) by sending it a 24V control signal, your Arduino can be used to control the optocoupler which is switching the 24VDC signal. This provides isolation and a higher drive capacity to the Arduino. Some of you may realize that the same thing can be done with a relay. The benefit in this case is that an optocoupler is (a) less expensive than a relay, (b) much smaller than a relay and (c) can be driven directly from the Arduino digital output without additional drivers or inductive protection. The drawback is that only very small signals can be switched, but for the right application it’s perfect.
In short, the optocoupler is a very useful addition to the toolbox of available interface components that can be utilized by the Arduino.