After the Battle of the Little Bighorn in 1876, the U.S. Army created forts in eastern Montana, including one where the north-flowing Tongue River flowed into the east-flowing Yellowstone River. The first fort was known as the Tongue River Cantonment or the Tongue River Barracks and was founded on August 27, 1876. A second, permanent fort was constructed on higher ground two miles to the west of the mouth of the Tongue and this became Fort Keogh.
Fort Keogh (named after Captain Myles Keogh, one of the battle dead, whose horse, Comanche, was the lone survivor of Custer's command) started as a few rough winter cabins, but grew into a moderate sized western fort, from which its commander, General Nelson A. Miles, effectively brought the remaining "uncontrolled" Native Americans into subjugation during the last decade of the 1800s.
Nelson Miles said that "whiskey caused him more trouble than the Indians" and, after tiring of drunken soldiers causing problems during the winter campaign, evicted the sutlers who provided "liquid stock" in the spring of 1877. Moving two miles due east of the Tongue River Cantonment, these early merchants founded the first Miles City. Although fondly referred to as "Milestown," the first post office and first official plat both called the town "Miles City." When the old cantonment moved two miles west, the town literally picked up and followed, moving to the current site. The last occupants of Old Miles City stayed on until 1900 but the new community was the one that grew.
Before the town itself was founded, George Miles, the nephew of General Miles, who had accompanied his uncle on the western expedition and served in the quartermasters office, bought a herd of sheep, the first of many commercial enterprises in his involvement with the core founders of the town.
Livestock speculation brought thousands of cattle to the open ranges in the late 1880s, the railroad was extended through the area, and Texas drove numerous cattle to Miles City to fatten them on free grass and move them to where they could be loaded on trains bound for the slaughterhouses in Chicago.
Miles City established a municipal electric utility around 1887 and it was a source of civic pride (as any city would have towards its own utilities) until a traveling employee of Minnesota Northern Power (predecessor of MDU Resources Group, Inc.) told the city council "the emperor has no clothes;" i.e., the system was far less efficient and in worse shape than they thought. The city council eventually put the question to the voters who instructed the city to sell the utility. By this time, the people with the Montana Power Company (now NorthWestern Energy's Montana division) became aware of this and were soon locked in an epic battle with Minnesota Northern over the franchise. A franchise election was held to determine who would serve Miles City on June 28, 1927. Minnesota Northern won by a scant 16 votes.
Miles City experienced rapid growth until the 1920s and 1930s, but became overshadowed by the upstart upriver town of Billings, which was at the cross roads of transportation routes, and it became a banking center, oil refining center, and medical service center and is now the largest city in the state.
The publicly owned Miles City Municipal Airport is located less than two miles (3 km) from town. Notably, it was the site of an early scheduled airline crash, involving Northwest Airlines Flight 1, which caught fire and crashed shortly after takeoff in January, 1939.