There are 2 solutions. Some copnnect both motors to the same driver, so there is nothing special to do. That is why RAMPS has 2 motor connectors soldered for z axis. The other solution is 2 drivers. In that case, you have to enable mirror z axis and select the stepper driver for the mirrored z axis.
Also make sure acceeration and speed are not too high and both motors can turn easily. If not alligned motors might block due to friction.