Law was commissioned as an officer into the 54th Regiment of Foot (from 1881 The Dorsetshire Regiment) in July 1869, was promoted to lieutenant on 28 October 1871, and served in the Second Anglo-Afghan War 1878–1880. Promoted to captain on 24 January 1883, to major on 21 June 1890, and to lieutenant-colonel on 19 November 1897, he commanded the 2nd battalion Dorsetshire Regiment during the Second Boer War in South Africa from 1900 to 1902 where he was present during the Relief of Ladysmith, and the battles of Laing's Nek and the Tugela Heights. For his services in the war, he was mentioned in despatches three times, received the Queen's Medal with five clasps and the King's Medal with two clasps, and was appointed a Companion of the Order of the Bath (CB) in the April 1901 South Africa Honours list (the award was dated to 29 November 1900; he only received the actual decoration from King Edward VII at Buckingham Palace on 24 October 1902). After the end of the war in June 1902, he returned to the United Kingdom in the , which arrived at Southampton the following month. Law was placed on half-pay in August 1902, and retired with the rank of colonel in 1906.