You are making a home-made galvanic isolator. This is not a very good way of making an isolator. You should use a part that has a single LED and two photodiodes or phototransistors. You have stated no accuracy specification so I won't comment further.
Isolators are non-trivial and you might want to just buy one that has been designed properly.
As far as protection, you should at least have a series resistor on the LED otherwise an incorrect connection from your +24V (typical) loop supply across the LED will burn out the LED instantly. For example if the wires to your two-wire sensor get shorted together (very, very common).
The resistor value will depend on the compliance voltage of your transmitter, the supply voltage and the total resistance of your wiring and receiver(s). The wattage rating should be sufficient to withstand a direct short indefinitely (you could use something like a MOSFET to limit the current if the resistor turns out to be impractical)