it's believed he committed suicide after losing his employment -- and lots of other things -- on account of being gay. strictly speaking it wasn't the military, but a different part of the security apparatus.
If it was suicide at all: https://en.wikipedia.org/wiki/Alan_Turing#Death