On 24 April 1793, Elphinstone was appointed a second lieutenant in the Royal Engineers. He was present for the expedition that took the Cape of Good Hope in 1795, and was promoted to lieutenant on 5 February 1796 and captain on 1 July 1800. Elphinstone commanded the engineers in Sir David Baird's Indian army sent to help expel the French from Egypt in 1801. Sent on a mission to Portugal in 1806, he was the commanding engineer at the Battle of Montevideo in 1807, under the overall command of John Whitelocke. He returned to Portugal in 1808, commanding the Royal Engineers of the Peninsular army.