Ralph was educated at St Paulís School, and at St Georgeís Hospital, qualifying M.R.C.S., L.R.C.P. in 1899. He began his military career in the Royal Navy, being appointed Surgeon on 26th February 1900, but resigned in 1902 to join the Royal Army Medical Corps. He received a commission within the Medical Services on 1st September 1902, at the rank of Lieutenant. From 1903 to 1908 he was stationed in India, during which time he was promoted to the rank of Captain on 1st March 1906. In 1907 he took the diploma in public health [D.P.H.], and in 1910 became a specialist in Bacteriology. On 1st March 1914 he gained promotion to the rank of Major, and was stationed at Netley when war was declared. Forming No 2 Sanitary Section at Netley, he became their Commanding Officer. The unit was mobilized on the 8th August, then sailed from Southampton to Boulogne on the 13th. Arriving the next day, he entered the war in France on 14th August 1914.
From 18th December 1916 to 10th February 1919 Ralph served under the rank of acting Lieutenant Colonel. During this time, in 1917, he became Assistant Director of Medial Services (Sanitation) at the Headquarters of the Line of Communication. On 29th January 1919 he was awarded the French Bronze Medal for epidemics
From March to June 1919 he was posted to North Russia, and again served under the rank of acting Lieutenant Colonel from 22 March to June 1919.
On 3rd June 1919 he was promoted to the rank Brevet Lieutenant Colonel, and from 1919 to 1920 became Assistant Director of Hygiene at the Headquarters, Eastern Command. From 1920 to 1921 he took up the post of Assistant Director-General at the War Office. During this time, from 31 October 1919 to 30th September 1921 he served under the rank of Temporary Lieutenant Colonel. On 8 March 1924 he finally received the rank of Lieutenant Colonel, then served in Egypt from 1924 to 1928, becoming Assistant Director of Hygiene with the Headquarters staff of the British Troops, Egypt from 1926 to 1928. From 1928 to 1930 he served as Professor of Hygiene at the Royal Medical College, during which time on 16th September 1929 he gained promotion to Brevet Colonel and Kingís Honorary Physician. On 1 June 1930 he gained promotion to the rank of Colonel, then from June - September 1930 he took up the post of Deputy Director of Medical Services at the Headquarters, Scottish Command. On 15th June 1932 he was promoted to Major-General.
On 2 June 1933 he was appointed an Officer of the Order of the British Empire [OBE]. In June 1934 he was appointed an officer of the Order of St John of Jerusalem [OstJ], and on 3rd June 1935 he was appointed a Companion of the Order of the Bath [C.B.]. He retired from the army on 26th September 1935, and ceased to be on the Roll of Officer on 26th September 1942. Ralph was the son of Captain W Ainsworth; and the husband of Florence, the daughter of Imre Kiralf of New York - they had two daughters.