It looks like an early hospital/nursing home or asylum design. A prison would not have had the open courtyard.
I wonder if there are any traces of other nearby structures? In the 1990s (or thereabouts) a Roman-era British town (or village) the name of which has survived was finally found, a completely abandoned site other than having been farmed for 15 centuries or so since.