Severe Voltage Drop When Applying a Load to Opto-Isolator Circuit
With this circuit, the "load" is meant to be connected between "HV" pin and the "OUT1" pin. When the input is low, the output pin should be capable of sinking a significant amount of current (tens of mA, at least &mdash; note that the drive to the output transistors is limited by R3 and R4).

When the input and output is high, the only source of current is the 10k&Omega; resistor R6, which can only source at most 0.5 mA if "HV" is 5V.

... And if the load is inductive, like your solenoid, be sure to connect an antiparallel diode across it, in order to avoid frying the transistor with the inductive kick.