In 1879, Pirie obtained a commission to the
1st Dragoon Guards as a
second-lieutenant, but was transferred to the
7th Dragoon Guards shortly afterwards and spent time stationed in
Aldershot and
Norwich. In 1881 he was promoted to
lieutenant and was transferred to the
4th Dragoons a year later. He was stationed in
Egypt during the
Anglo-Egyptian war of July–September 1882, serving as an extra
Aide de Camp to Sir
Gerald Graham. He was consequently commended in despatches, and awarded the
Egypt Medal, presented to him in 1883 at a
royal levee at
St James Palace, overseen by the
Prince of Wales. He was exchanged to the
1st Life Guards later that year. Pirie was responsible for overseeing the delivery of a fleet of 44 boats for the
Nile Expedition in 1884, in which he participated (including the battle of
Kirbekan), as well as the
Sudan campaign, seeing action in the battles of
Teb and
Tamai. He was again mentioned in despatches in 1885, whiles stationed in Egypt. While there, he was promoted to
captain in the
5th (Royal Irish) Lancers and was stationed in
Ireland upon his return. Another transfer, to the
3rd (Kings Own) Hussars occurred in 1888. In April 1890, Pirie was appointed as ADC to the
Governor of Ceylon,
Arthur Havelock, a position he held until he resigned from the role in 1893, when he returned to the 3rd Hussars in Ireland. Pirie officially resigned from the military in 1898, having been
seconded after his successful election bid in 1896. Despite this, he returned to the military on two occasions, first serving in
South Africa in the
Remounts Department during the
Second Boer War in 1900, and then again following the outbreak of
World War I, between 1914 and 1918. During this time he was appointed as a Railway Transport Officer and later an assistant Military Landing Officer. In 1916 he was appointed temp. Major of 1st (Garrison) Battalion,
Suffolk Regiment. He was later promoted to
lieutenant-colonel, before retiring once more after the end of the war. In 1900, Pirie was appointed a
deputy lieutenant of Aberdeen, a role he held until 1921. ==Political career==