The effect of compressed CO2 on the properties of ordered mesoporous carbon (OMC) was investigated based on the self-assembly of surfactants in aqueous solution under mild conditions, and the acidic or basic conditions commonly used in traditional methods were substituted by compressed CO2. Compressed CO2 acts as both a physiochemical additive and a reagent to produce an acid catalyst in the synthesis. This new one-pot assembly approach can efficiently adjust the porous characteristics of OMC by employing different amounts of compressed CO2, and the self-assembly mechanism is proposed. The spherical micelles formed by triblock copolymer Pluronic F127 serve as a structure-directing agent for the controllable synthesis of nanomaterials. Resorcinol/phloroglucinol and formaldehyde are used as carbon-yielding components. It was found that CO2 can penetrate into the hydrocarbon-chain region of the F127 micelles, leading to template swelling and influencing the properties of OMC. The surfactant and precursors attracted by H-bonding interactions self-assemble and produce OMC after polymerization and carbonization. The resulting OMC as a supercapacitor electrode material exhibits outstanding specific capacitances, and the electrochemical performances change as the structural properties are varied.