Same way as oil and gas has been contained for hundreds of millions of years: there is an impermeable caprock that contains the reservoir/aquifer.
In many cases, aquifers are so huge that injecting even a few million tonnes of CO2 makes only a small difference in pressure. And if the pressure did increase too much, we would drill a well deep at the aquifer bottom and take out some of the water.