Grothendieck went to Vietnam to deliver lectures and a reportreport of what he did can still be found online.
Bertrand Russell was imprisoned during WWI for anti-war activities and wrote "Introduction to Mathematical Philosophy" (1919) while in prison.
Hardy, in protest at Russell's consequent dismissal from Cambridge, left Cambridge to Oxford and continued working there and collaborating by mail with Littlewood. Both of them worked during that time in Mathematics and there is a work of fictionfiction written about it.