How to set a digital out to 24V Vcc
Use a NPN/NFET transistor as an open collector/open drain output. Use a resistor pull-up if your load doesn't have one. Alternatively, opto-isolators will give you the same functionality with the freedom to separate your power and ground domains. I would not recommend using an op-amp.

Now, to clear up some misconceptions:


CMOS op-amps will get you pretty close to the power supply rails. For example, the OPA211 from TI will get you within 0.2V of your power supply rails when sinking or sourcing load of 1-3mA, which isn't too bad.
Unless your  load is insanely picky about logic levels, (which makes no sense at all on industrial equipment), you don't actually need exactly 24V and 0V. Most equipment I've seen can tolerate +/- 10%, and logic levels are fairly forgiving. Check your load's datasheet, and you will find input logic high and logic low thresholds. Sparkfun has an excellent writeup on logic levels.