Maxwell served with the Black Watch in the Anglo-Egyptian War of 1882, taking part in the storming of the Egyptian fortifications at Tel-El-Kabir and rising to the rank of captain. He was first mentioned in despatches as an assistant provost-marshal and camp commandant during the Nile Expedition of 1884–1885. He played an active role with the Egyptian frontier forces in the Sudan, and won a Distinguished Service Order in the engagement at Ginnis and was also present in the battle at Gemaizah in 1888 where he was made brevet lieutenant colonel. During the reconquest of Sudan he led the 2nd Egyptian Brigade, and was present at the 1898 Battles of the Atbara and Omdurman, where he was among the first to enter the Khalifa's palace. In 1897 he was appointed Governor of Nubia and in 1898 was appointed Governor of Omdurman.