Hydraulic fracturing in shale gas formations involves the injection of large volumes of aqueous fluid deep underground. Only a small proportion of the injected water volume is typically recovered, raising concerns that the remaining water may migrate upward and potentially contaminate groundwater aquifers. We implement a numerical model of two-phase water and gas flow in a shale gas formation to test the hypothesis that the remaining water is imbibed into the shale rock by capillary forces and retained there indefinitely. The model includes the essential physics of the system and uses the simplest justifiable geometrical structure. We apply the model to simulate wells from a specific well pad in the Horn River Basin, British Columbia, where there is sufficient available data to build and test the model. Our simulations match the water and gas production data from the wells remarkably closely and show that all the injected water can be accounted for within the shale system, with most imbibed into the shale rock matrix and retained there for the long term.