Significant amounts of artefacts of the Magdalenian (c. 16'000 to 14'000 years ago) have been excavated near Olten. There are also finds dated to the Mesolithic and Neolithic, but there is no trace of a settlement, and no ceramic finds; finds dating to the Bronze and Iron Ages are also rather limited. There was a vicus at the site during the Roman era. The name of the settlement is not known, but it seems to have been of a certain importance, presumably reflecting the presence of a bridge across the Aar River. The Roman settlement was probably destroyed in the later 3rd century. At the end of the 3rd century, a fortification was built at the bridge-head, on the south-eastern corner of the earlier vicus. This fortress was abandoned in the 4th century, and later replaced by a larger castle, comparable to late Roman fortresses protecting crossings of the Aar at Solothurn and Brugg.
The medieval settlement was built on the foundations of the Roman castle. It is first mentioned in 1201, as Oltun (conjectured as continuing an *Olodunum, with the Gaulish suffix dunum "fort", and a prefix olo-, possibly from a hydronym, thus "river-fort"). It was in possession of the counts of Frohburg in the 13th century, passing to Kyburg in 1377 and to Habsburg in 1384. Olten passed under the administration of Basel in 1407, which invested in infrastructure, which was however destroyed in fires in 1411 and 1422. Basel lost interest in rebuilding the town again after the 1422 fire, and sold the settlement to Solothurn in 1426.
Throughout the medieval period, Olten was little more than a fortified bridge-head with some services (blacksmiths, taverns); its total population is estimated to about 500 people for the year 1600. Olten lost its city rights in 1653 as punishment for its support of the rebels in the Swiss Peasant War. This resulted in a lasting tradition of resistance against authority in Olten, and the town welcomed as liberators the French troops in