Since I have typed my answer already I'll post it anyway.

What is optical isolation?
The goal is
galvanic isolation, or simply said: No electrical connection between two parts of a circuit, or different devices.
But we still need to transmit information, that is our goal after all.
So we use light as a medium for a (small) part of the distance. Thus optical isolation. The classic part is the
optocoupler.
With "some" more parts you can transmit digital information very successfully. Here a
link to a RS232 UART optical isolater build out of "standard" parts.
OR you could buy a part like the
ISO7721A that has the whole stuff inside a convenient DIP8 or SO8 package. (TTL levels on both sides, 4000V
peak Isolation)
You can get those parts for various speeds and isolation voltages. The higher the voltage the larger the distance between sides, up to parts that use fiberoptics between them, but then you need "some" distance at 500KV or more.

It is also possible to use magnetic isolators. They are used when you also have to transmit energy.
The transformer is the most obvious example. =)
The drawback is that you can only transmit AC signals and that their isolation voltage is limited.
And there is of course always a Plan B, or in this a "high tech" approach: Use a Bluetooth module, no stinking cables on the bench.

(There are some cheap and simple to use BT modules available. You can use them like a RS232 interface. Quite popular, say the BTM-222.)