Note that there is the law of mass and energy conservation, but there is no law about volume conservation.
Molecules of matter are in eternal motion. Molecules of gases move freely by flying between collisions. Nitrogen or oxygen molecules of air have an average speed of a supersonic fighter, colliding at rate typically 10 billions collisions per second, with the mean free flight distance typically 70 nm. Such motion creates space between them. ( Try to keep a sworm of vivid children in tight packed formation. )
Molecules of liquids and solids are held together by attractive forces. Loosely for the former, so they continuously separate and rejoin. Tightly for the latter, so they just vibrate.
Another reason for space between molecules is electrostatic repulsion of their electrons, if they get too close. If you hit a wall, you did not really touch it. The wall started to repulse you by the mighty electrostatic force, when your and it's electrons got too close.
If you mix 1 L of ethanol and 1 L of water and let it cool down ( because it warms up ), the total volume will not be 2 L, but about 1.96 L. It is due the fact the average energy of bonds water-ethanol (via hydrogen bonds) is greater than the average energy of bonds water-water and ethanol-ethanol. This leads to shorter average distance between molecules ( fractions of nanometre ), as stronger bonds are shorter, and to the volume contraction.
Aside of this chemical reason, there is geometrical one as well, both adding to each other:
Fill a container e.g. by
peas/beans, and fill an identical container by rice. Then mix them and try to fill both containers again. You will see some volume will remain free. Rice will partially use otherwise free space between peas/beans.
The similar phenomena probably happens for the system sucrose-water, as I have no such personal experience.
Generally, such volume changes, smaller or bigger, always happen when 2 components are not indifferent with respect to each other and properties of the mixture are not a linear function of its composition.