The theory is that aerobic bacteria covering the surface of the porous live rock and sand convert harmful ammonia (from fish and invertebrate waste) into nitrites, then nitrates, which are much less harmful to the tank's inhabitants.
Live sand, a term used in aquarism, is natural reef coral sand populated with millions of beneficial bacteria and organisms which aid in the dissolving of organic wastes like ammonia, nitrites and nitrates produced by larger organisms in saltwater aquariums.