Water is a most unusual substance. A unique aspect is that the solid form (ice) actually has a LOWER density than the liquid form! This is why ice floats. Most solids are denser than their corresponding liquids at the same temperature and pressure. This is not the case for H2O.
So if a can is filled with ice and sealed the ice occupies some volume and the pressure in side the can is fixed at some value appropriate for the Temp conditions. Now as the can and ice warms up, the ice melts and the liquid OCCUPIES LESS VOLUME THAN THE ICE did. Now since the pressure is inversely proportional to the volume, the pressure INSIDE the sealed can drops... when that happens, the outside the can pressure is BIGGER than the inside the can pressure and it is this pressure difference that if it exceeds the strength of the can causes the can to collapse. A similar effect can be illustrated via the following experiment. put some water in a coke can and bring the water inside the can to boiling... the pressure in the can will be equal to the pressure in the room with the important difference that the pressure in the steam of the can will be water pressure whereas in the atmosphere the pressure is exerted by diatomic oxygen and diatomic nitrogen. Now SEAL the can and let it cool. ... As the steam cools in the can the steam will condense back to liquid water (which occupies less volume than steam)....and again if the can is sealed the pressure inside will drop below that outside and the can will spontaneously crush itself.
If you do this experiment at home be careful. I would suggest heating the can with water inside by put the can in a bigger pot with water in IT so that you never heat the can directly... then once the water inside the coke can is boiling remove it, seal the can and and let it cool. You should do this experiment when a teacher or you mom o dad can watch because it can be dangerous when playing with boiling water and kitchen stoves.
So you always have to think of the consequences and dangers of any experiments, be prepared to handle emergencies and to always expect the unexpected. Many chemists have lost their lives or been injured because they let their guard down.