How does Galvanic isolation work?
The point of isolation is to provide a facsimile on the output of what appears on the input yet floating from the input.

For example you want to generate a 5V sine wave from the mains. A suitable transformer will do this for you and will allow you to tie one side to earth making an inherently safe voltage.  Without the isolation the output could be potentially fatal.

In other cases we do not need an accurate representation of the input just a digital signal to say for example "Is the mains more than 90V?".  An Opto is likely to be used for this but would allow this information to be passed safely to the output.