During World War II, Dunlop was appointed to medical headquarters in the Middle East, where he developed the mobile surgical unit. In Greece he liaised with forward medical units and Allied headquarters, and at Tobruk he was a surgeon until the Australian Divisions were withdrawn for home defence. His troopship was diverted to Java in an ill-planned attempt to bolster the defences there. On 26 February 1942, he was promoted to temporary lieutenant-colonel. Dunlop became a Japanese prisoner of war in 1942 when he was captured in Bandung, Java, together with the hospital he was commanding.