Opto compressors are a type of audio effect that is used to reduce the dynamic range of an audio signal. They are commonly used in recording and mixing processes to achieve a desired sound. I don't want to write about the mechanism behind, I'd rather like to write about the result in music when using an opto compressor.
Optical compressors give less precise and consistent results than other types of compression. They are smoother so they are not the best type when we have to deal with transients - especially the hardest ones. Their attack and release times are pretty much slower that other types - so they may not be the ideal compressor for finalizing masters - the transients usually escape from the compression.
Opto compressors can be used to shape and sculpt an audio signal, adding smooth and subtle warm character and depth while maintaining clarity and definition. It is not coloring the sound very much so it results in a more clean soft "rounded" compression. I mainly use it as audio leveler - hence the prefix LA on one of the most famous hardware units of this type. It glues the more intense and less intense parts of an audio signal, in terms of volume, in a nice subtle way.

I very usually use that type of compression for vocals, drums and lead synths to control their dynamic range in a natural way - but the only restriction here is our imagination.
The most iconic hardware unit is the LA-2A Levelling Amplifier - there are tones of plugin emulations of this one.