An LED or IRED and a photodiode are combined in a single package to obtain a component called as optoisolator. This device shown in figure below actually creates a modulated light signal and sends it over a small, clear gap to receptor. The LED or IRED converts the electrical signal to visible light or infrared; photodiode changes visible light or infrared back into the electrical signal.
Figure-- An optoisolator uses an LED or IRED (input) and a photodiode (output).
A major source of headache for engineers has been the fact that, when the signal is electrically coupled from one circuit to another, the impedances of two stages interact. This leads to nonlinearity, oscillation which are unwanted, loss of efficiency, or the other problems. Optoisolators overcome this effect, as the coupling is not done electrically. If input impedance of 2nd circuit changes, the impedance that the 1st circuit sees will remain unaffected, being simply the impedance of LED or IRED.