The line over the M signified multiplying the number by 1,000. The letter M represents 1,000, so incorporating a multiplier of 1,000 gave a value of 1,000,000. The Romans rarely had the need to represent numbers this high, so they did not have a special symbol or word for 1,000,000.
The switch from using the line over the M to the one under the M is a recent change. Most computer fonts do not have a ready means to add a line above a letter, so typesets have shifted to the underlined version for ease of display.Learn more about Numbers