After studying at Brussels he returned to Scotland in 1829 and founded, in 1830, the Edinburgh Journal of Natural and Geographical Science, which was discontinued in the following year.
In 1834 Ainsworth, after studying under Sir Edward Sabine, was appointed surgeon and geologist to the expedition to the River Euphrates under Francis Rawdon Chesney.
During the summer he explored the Kurdistan mountains and visited Lake Urimiyeh in Persia, returning through Greater Armenia; and reached Constantinople late in 1840.
For some years he acted as honorary secretary to the Syro-Egyptian Society, founded in 1844, and he was concerned to promote the Euphrates and Tigris valley route to India, with which Chesney's expedition had been connected.
On his return from the Euphrates expedition he published his observations under the title of 'Researches in Assyria, Babylonia, and Chaldea,' London, 1838, with a dedication to Chesney.
Ainsworth was also the author of: He translated François Auguste Marie Mignet's 'Antonio Perez and Philip II,' London, 1846, and edited William Burckhardt Barker's ‘Cilicia: its Former History and Present State, with an Account of the Idolatrous Worship Prevailing There Previous to the Introduction of Christianity,’ 1862, and 'Lares and Penates' from the papers of William Burckhardt Barker, London, 1853.