Macdonald was born on 8 February 1862 in Rajahmundry in the Madras Presidency, India, and was educated at Aberdeen Grammar School and the University of Aberdeen.
As a lieutenant, on 15 May 1885 Macdonald was appointed to the corps of Bengal Sappers and Miners, Torpedo service, Calcutta on special duty as a balloon photographer.