Ice is the solid state of water and we usually see it floats in bodies of water. The reason for this is their densities. First, let us first talk about the effects of densities in floating as general.
Suppose you have a solid A and liquid b getting into contact with each other. If solid A has more density (mass per unit volume) compared with the liquid b, it will sink. On the other hand, if solid A has lesser density compared with liquid b, it will float.
Ice has lesser density compared with the liquid water. This is unusual because most substances have higher densities when solidified. The reason for this phenomenon is the hydrogen bond that enables the frozen water or ice to have structure that makes it occupy more space and form crystalline lattice structure.
Ice is less dense than liquid water. Liquid or solids that are less dense will usually float on liquids that are more dense.
Density is a measurement of mass per unit of volume, and naturally, heavier things will sink faster than things that aren't as heavy, and this applies to whether things will float or not.
Ice is less dense than water. This is because of water's unique chemical bonds. Water has lots of hydrogen bonding. Ice's bonds are longer than liquid water's are.
When looking at a phase diagram (I have attached a link below), you will notice that water is different from other compounds. The solid-liquid line has a negative slope compared to the positive slope in other compounds. For water, the pressure decreases at constant temperature at the solid state.
Ice floating is a very big deal in biology as well. Because ice floats, aquatic life is able to thrive during winter. If ice did not float, water would freeze from the bottom of the ocean/river/lake to the top, reducing plant life and available space.