The rail gauge is the distance between two rails on a rail bed of a railroad. Throughout most of the world, the gauge has been standardized at 1435 mm (4'8½"). This is known as "standard gauge."
Except for the Great Western Railway's Broad gauge, few main-line British railways even in the early days used any other gauge than 4'8½", because this was the gauge to which commercial manufacturers of railway equipment offered.
Originally in the United States a variety of gauges were used. Some, primarily in the north-east, used the British standard gauge; others did not, including track gauges up to six feet across. Given the nation's recent independence from the United Kingdom, arguments based on British standards had little weight. Problems began as soon as railroads began to meet other railroads, and in much of the eastern United States the Standard Gauge was eventually adopted. Most Southern states standardised on a five-foot gauge. The American Civil War eventually decided the gauge question; the South's railroads were so destroyed that they had to be essentially rebuilt from scratch, and unsurprisingly the de facto Northern standard became the American standard.
For military reasons (they did not want potential invaders using their own rail system for logistical reasons), some countries chose a broader gauge, and thus Russia and some former parts of the Russian Empire (Baltic region and Finland), have a wider gauge of 1535 mm (see note *A below) as does Spain and Portugal (which despite being neighbours have slightly different broad gauges, some special passenger trains have special wheel sets and can actually run through). With the advent of the European Community, Spain has embarked upon a partial regauging program.
In some cases a much narrower gauge was chosen. While this generally can't handle as much tonnage, cost of construction is somewhat less expensive, and this is particularly true in mountainous regions.
A dual gauge track has three or four rails positioned such that trains of two gauges can use it; it is applied in part of the railroads of Switzerland, Australia, Brazil, North Korea, Tunisia and Vietnam.
There is a story that rail gauge was derived from the rutways created by war chariots used by Imperial Rome, which everyone else had to follow to preserve their wagon wheels, and because Julius Caesar set this width under Roman law so that vehicles could traverse Roman villages and towns without getting caught in stone ruts of differing widths. However, an equal gauge is probably coincidence. Excavations at the buried cities of Pompeii and Herculaneum revealed ruts averaged 4'9" (1447.8 mm) center to center, with a gauge of 4'6" (1371.6 mm). The designers of both chariots and trams and trains were dealing with a similar issue, namely hauling wheeled vehicles behind draft animals.
A more feasible theory behind the measurement of the standard gauge is that it reflects vehicles with a 5' outside gauge.
Afghanistan is in an interesting position, writing in 2004, because they are at the crossroads in Central Asia virtually without any railways at all. Should they decide to built any, then the choice of gauge is complicated by the fact of being surround by 3 different gauges in four "gauge oceans".
Note *A: The Russian gauge of 5' 0" is normally metricized as 1524mm rather than 1535mm.