The science of density and buoyancy determine whether objects will sink or float in water. If an object's density is greater than water, it will sink. Conversely, if an object's density is less than water, it will float. In the case of rubber, it floats because its density is far less than that of water.
Density

Density is a measure of how much mass an object possesses for a given volume. Mass is typically measured in grams, and volume in cubic centimeters. The denser an object is, the more it will weigh. For example, if object A has a density of 10 and object B has a density of 100; object B will weigh 10 times as much as object A.
Buoyancy

Archimedes' principle declares that the buoyant force on a submerged object is equal to the weight of the fluid displaced by the object. Stated another way, if the mass of the object is less than the mass of the water, for the given volume, the object will be forced upward to the surface by the buoyant force. If the mass of the object is greater than the mass of the water, for the given volume, the object will sink because the buoyant force is not strong enough to support the object.
Density's Relationship with Buoyancy

Buoyancy is dependent upon two factors: mass and volume. These happen to be the same two factors that determine an object's density. In order to compare the relative masses of an object and water, the issue of volume must be removed from the equation. This is accomplished by comparing the density of the object with the density of water. The density of water, though it varies slightly depending on temperature, is assumed to be 1 gram per cubic centimeter. By comparing this density to the density of any other object, it can be determined if the object's relative density is higher or lower than that of water. If it is higher, it will sink, and if it is lower, it will float.
Rubber in Water

The density of soft rubber is 0.11 grams per cubic centimeter. If you had a rubber cube with sides equal to 10 centimeters, its volume would be 1,000 cubic centimeters. The mass of this rubber cube would be equal its density multiplied by 1,000, or 110 grams. If this rubber cube was placed into water, it would displace 1,000 cubic centimeters of water. The mass of the water displaced would be equal to its density multiplied by 1,000, or 1,000 grams. Archimedes' principle states that the rubber would float because the buoyant force of the water, equivalent to 1,000 grams, would be greater than the weight of the rubber cube, 110 grams. While this demonstrates the math behind rubber's buoyancy, all that is really required is to simply compare its density to that of water, as this takes volume completely out of the equation. Because rubber's density is less than that of water, you know that it will float  no matter how much rubber you submerge.
References
 Photo Credit Digital Vision/Digital Vision/Getty Images