An amplifier does not really amplify. Rather, it attempts to copy, usually in a linear manner, the input signal. This copy is produced by a voltage divider at the output, a voltage divider consisting of the output impedance of the amplifier and the load impedance. Since this copy is seen as the voltage across the load impedance, the copy's voltage swing can only be so large. For example, a +/-10v copy of a +/-100mV (amp gain = 10/0.1 = 10x10 = 100) signal produced from a voltage divider cannot exceed +/-10v if the split supply for the voltage divider is +/-10v. However, in most cases, that +/-10v split supply is larger than the largest signal due to additional losses internal to the amp, so one may get only +/-9v maximum swing. For an amp with such losses, one says the particular amp cannot swing "rail to rail."
In other words, and to summarize, "rail to rail" means "to the supply voltages." A voltage divider cannot produce a voltage that exceeds the supplied voltage, the supply "rails." You only get out what you put in. Hence, for an amp with a +/-V supply, the output voltage can never exceed the 2V "rail to rail" voltage.
I would guess that the term "rail to rail" is derived from the idea of the wheels of a train (and therefore the train itself) being locked between two rails.