Lets say you have picked metric as your unit of measurement in Mach2. You work out how many steps/pulses it takes to move your machine one metric unit ( mm )
Go to configure in Mach 2 and then pick Motor tuning. You will see a step per unit setting in there.
That way any Gcode that is written for metric will drive your machine axis according to the steps per unit setting. Depending how your axises are driven you may have to set the steps per unit setting for each axis differently.
Don't make the mistake of making Gcode for imperial code. Otherwise Mach 2 will think that one unit is mm and in-fact it is one inch.
Being outside the square !!!