Volume changes in soil
Unsaturated soil consists of individual soil particles held together by water and air pockets between the particles. The air and water combination pulls the soil particles together by surface tension. This results in a force called 'soil suction'.
Wetting the soil reduces this soil suction force. This causes the soil particles to separate and the soil volume to increase. Drying the soil revives the suction force which pulls particles together causing the soil volume to decrease.