The chemistry of the elements is heavily altered by high pressure, with stabilization of many new and often unexpected compounds, the emergence of which can profoundly change models of planetary interiors, where high pressure reigns. The C-H-O system is one of the most important planet-forming systems, but its high-pressure chemistry is not well known. Here, using state-of-the-art variable-composition evolutionary searches combined with quantum-mechanical calculations, we explore the C-H-O system at pressures up to 400 GPa. Besides uncovering new stable polymorphs of high-pressure elements and known molecules, we predicted the formation of new compounds. A 2CH4:3H2 inclusion compound forms at low pressure and remains stable up to 215 GPa. Carbonic acid (H2CO3), highly unstable at ambient conditions, was predicted to form exothermically at mild pressure (about 1 GPa). As pressure rises, it polymerizes and, above 314 GPa, reacts with water to form orthocarbonic acid (H4CO4). This unexpected high-pressure chemistry is rationalized by analyzing charge density and electron localization function distributions, and implications for general chemistry and planetary science are also discussed.