There are special optical isolators available with separate feedback circuits designed for high linearity and fidelity but, for non-critical applications, a standard opto isolator may be adequate if it is driven by a current source instead of a voltage.
This eliminates the non-linear input LED voltage to current relationship, with the output current being quite linear with respect to the input current, especially for low current levels.
Below is the LTspice simulation of such a circuit...