Stansfeld was educated at Winchester School, before entering the Army in 1897. He served in the Boer War in South Africa (1899–1902) during which he was involved in operations near Colesberg and the Relief of Kimberley and also saw action at the Battle of Paardeberg and was mentioned in dispatches. He was appointed a Companion of the Distinguished Service Order (DSO) in 1900 and promoted to Captain in 1902.