4016 quad bilateral switch You will want to use high speed devices. Please reference the graphic. When enable is LOW input A is connected to output A1. When enable is HIGH, input A is connected to output A2. In other words you could connect the direction pin to the enable pin and step pin to input A.
Outputs A1 and A2 would connect to pin 3( PP) and pin 2 (NP). Do not forget the NOT gate in the design. You should test it on a disconnected motor for safety. In other words you need a high speed digital switch where you can switch a singe input to 2 outputs.
Hope this helps,