Ainsworth began his military career in the Royal Navy. On 26 February 1900, he was appointed a surgeon in the Navy Medical Service.[4] In 1902, he transferred to the Royal Army Medical Corps, British Army, where he was appointed lieutenant on probation on 1 September 1902.[5]