Stepper motor is not working according to code
Does the relay actually connect the pin to ground when it is off?  Or does it leave the input floating?  If it leaves it floating then you should use a pull-down resistor to make sure the pin actually sees ground and not stray interference.  

If you can rewire the relays you can use an active low configuration and save the resistor since the Arduino has built-in pullup resistors.