While it might seem surprising, "miles" originally referred to soldiers and military service. It comes from the Latin word "miles," which meant "soldier".
Over time, the meaning of "miles" shifted to refer to the distance covered by a soldier on foot, which is how we got the word "mile" as a unit of measurement. However, the word "military" still retains its connection to its original meaning.