I had a look at newspaper items with the phrase ‘last month solitary’. There are lots of them suggesting it was quite a common element of a sentence. But I didn’t find anything discussion of the thinking behind it. What I did see however were quite a few ‘first and last months solitary’.
Perhaps the idea was to encourage convicts to reflect upon their choices before being released.