When the net external force on the system is zero, the total momentum of the system is conserved. In the given case, when a ball hits the floor and rebounds, no external force is acting on them. Thus, the total momentum of the system is conserved. However, it is an clastic collision. So, some energy will be lost in the form of heat, etc. Hence, the total mechanical energy of the system will not conserved.