Controlling a stepper motor with a Siemens S7 1200
The inputs on the stepper driver module are optical isolators, in other words, LEDs. The manufacturer provided connections to both sides of the input, but you can tie one side to +5V (from the S7) as indicated on the driver module silk-screen writing. To actuate the control signal the S7 provides a logic low, 0V, or ground to the other input. Your control signal is in effect providing power to turn on the internal LED which passes the control signal through optically while maintaining electrical isolation. 

If +5 volts in unavailable +24 vdc could be used with a 2.2K ohm resistor in line to limit the LED current to about 10 mA. Also you may vary the parameters to accommodate the output choices available from the S7. The goal is to provide about 10 mA through the opto-isolator to turn the LED on and off under your control. 

Mechanical relay outputs for the S7 PLC will not work though because relay outputs can bounce a few times in a millisecond and the driver will interpret that as multiple motor steps. Solid state outputs will work. Digital outputs are the most common method.