Allowing the lasagna to cool allows the cheese inside the lasagna to cool, which allows the lasagna itself to firm up. This will make it so everything doesn't spill out when cut into slices.