Change Direction of 12v DC Motor Rotation using Relay
Something like this should work. Note that the limit switches are different- one is 
normally closed and the other is normally open. If you have a relay with three form C 
contacts you can avoid using the diodes. 







simulate this circuit &ndash; Schematic created using CircuitLab

The two contacts are used to reverse the motor in the usual way, but one contact
does double duty as a self-hold for the relay. The diodes prevent SW2 from shorting
out the supply when the relay is de-energized and the limit switch to engage the 
relay is activated. 

You can put a bridge rectifier across the motor to absorb inductive spikes from the motor inductance.