We present the results of polarimetric ($R$ band) and multicolor photometric ($BVRIJHK$) observations of the blazar AO 0235+16 during an outburst in 2006 December. The data reveal a short timescale of variability (several hours), which increases from optical to near-IR wavelengths; even shorter variations are detected in polarization. The flux density correlates with the degree of polarization, and at maximum degree of polarization the electric vector tends to align with the parsec-scale jet direction. We find that a variable component with a steady power-law spectral energy distribution and very high optical polarization (30-50%) is responsible for the variability. We interpret these properties of the blazar withina model of a transverse shock propagating down the jet. In this case a small change in the viewing angle of the jet, by $lesssim 1^o$, and a decrease in the shocked plasma compression by a factor of $sim$1.5 are sufficient to account for the variability.