Are you using Mach3?
The software has no idea where your motors are installed, so it has no concept of front / back.
If you want to switch directions, go to Config > Ports and Pins > Motor Outputs... and place a checkmark next to "Dir Low Active".
This will reverse the axis' direction.