To be in quod- in prison. A corruption of quad, which is a contraction of quadrangle. The quadrangle is the prison enclosure in which the prisoners are allowed to walk, and where whippings used to be inflicted.
“Flogged and whipped in quod.”
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894