Perhaps surpisingly, what everyone describes as foam rubber very rarely is. More often it is foamed polyurethane.
There are types of foamed rubber, but they are much less common than foamed polyurethane.
You can find foamed rubber in cars, where the long, thin (usually) black seals around the doors are made from rubber (usually a type of EPDM or ethylene-propylene diene monomer), and some parts of those seals are foamed.
This material is made by extruding the rubber and adding a blowing agent to the rubber mix, which generates gas as it passes through the extruder. The gas bubbles up inside the rubber, making a dense foam material, and this is cured to make a material which is soft and spongy.
Foamed rubber is usually quite dense.
The material most people mean when they talk about foam rubber is a flexible polyurethane foam. This is used in mattresses and as padding in many different products. It comes in many colours: yellow being one of the more common, and is light (density around 20 or 30 kg/m3) with a dry feel to it. Most such foams are open-celled, which means that water or air can pass through the foam. In closed-cell foams, the individual pockets of air are isolated from each other, so the product will easily float in water.
It is made in a slabstock factory, which uses industrial machines to create huge err, slabs of foam. This is sawn into pieces of the desired size and shipped to the customer. The slabs are made by reacting a polyol with an isocyanate (almost always toluene di-isocyanate--TDI) for flexible foams and a blowing agent, such as liquid carbon dioxide. Previously they used CFCs, but these have been banned under the Montreal protocol). Materials make up typically 80 percent of the cost of foam at the slabstock manufacturer.