The number of people imprisoned has grown significantly in 30 years, with those on remand awaiting trial responsible for the biggest increases in recent years.