Brigadier Hugh Monro, who commanded the 52nd Lowland Brigade, based in Edinburgh Castle, between 1998 to 2001, said the “natural break” in June was an appropriate time to leave the role.
He said: “I have enjoyed this job and there is much work under way that I would have liked to bring to a conclusion.”
He sparked debate on female offenders after an inspection of Cornton Vale women’s prison in 2009, the first year of his appointment, and said Scotland now “leads the way”.
Other issues he explored include improved family contact for prisoners and better visiting facilities.
The 59-year-old served in the army for 36 years before retiring in 2008. During that time he led the operation to eradicate foot-and-mouth disease in southern Scotland.