The unsteady velocity and thermal boundary layers during the compression stroke under engine-relevant conditions are investigated using direct numerical simulation (DNS). The initial conditions are derived by a precursor DNS of the intake stroke, avoiding the use of any artificial initial and boundary conditions. The results show decreasing velocity and thermal boundary-layer thicknesses towards Top Dead Center (TDC) as a result of the decreasing kinematic viscosity. Compared to the fluctuating flow field, the azimuthally-averaged velocities are found to have a minor effect on the boundary-layer profiles, and as a result the boundary-layer structures at all engine walls during compression are similar. The averaged velocity and thermal boundary-layer profiles deviate strongly from the law of the wall, which is the basis for many wall heat transfer models in internal combustion engines. In density wall-normal units, the averaged as well as the rms boundary-layer profiles for velocity and temperature show a collapse onto a single curve during the whole compression stroke. This finding can serve as base for the development of novel wall heat transfer models. Finally, the DNS data showed that between 60% and 80% of the total wall heat losses during the compression stroke are attributed to convective transport due to wall-normal velocity fluctuations.