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.
Because of his leadership skills, he was placed in charge of
prisoner-of-war camps in Java, was later transferred briefly to Changi, and in January 1943 commanded the first Australians sent to work on the Thai segment of the
Burma-Thailand railway.
After being held in a number of camps in Java, he was eventually moved to the
Thai-Burma railway, where prisoners of the Japanese were being used as
forced labourers to construct a strategically important supply route between Bangkok and Rangoon. Conditions in the railway camps were
primitive and horrific — food was totally inadequate, beatings were frequent and severe, there were no medical supplies,
tropical disease was rampant, and the Japanese required a level of productivity that would have been difficult for fully fit and properly equipped men to achieve.
Along with a number of other
Commonwealth Medical Officers, Dunlop's dedication and heroism became a legend among prisoners.
A courageous leader and compassionate doctor, he restored morale in those terrible prison camps and jungle hospitals. Dunlop defied his captors, gave hope to the sick and eased the anguish of the dying. He became, in the words of one of his men, "a lighthouse of sanity in a universe of madness and suffering". His example was one of the reasons why Australian survival rates were the highest.