Prison is where you lock up captured Greatman.

You will be able to capture a Greatman if you become victorious when attacking enemy's Castle. The number of Greatmen you can keep in prison will increase when you upgrade the building. 

You can get buff effects for your Army if you have a Greatman in the Prison. Actual effect will vary depending on the level of the captured Greatman.