The application of carbon foam, such as microwave absorption, electromagnetic shielding, catalyst carrier etc., has recently received great attention due to its adjustable pore cell structure. However, the pore cell density of carbon foam is far from being accurately regulated, namely, the mechanism governing the cell density of carbon foam is still unclear. This problem has become one of the bottlenecks limiting the practical application of carbon foam. Herein, a carbon foam of mesophase coal pitch/carbon black (MP/CB) composite was fabricated by high-pressure pyrolysis. The dependence of pore cell density on the temperature, pressure, and quantity of carbon black, was investigated. It was found that nucleation rate of carbon foam can be expressed by a heterogeneous nucleation equation of microcellular plastics. The governing mechanism of the cell formation of carbon foam is similar to that of microporous plastics. The finding points out the direction to the study of the foaming mechanism of carbon foam by high-pressure pyrolysis. In addition, we found that the higher the pore cell density of carbon foam, the higher the compressive strength.