We study fluid-induced deformation of granular media, and the fundamental role of capillarity and wettability on the emergence of fracture patterns. We develop a hydromechanical computational model, coupling a "moving capacitor" dynamic network model of two-phase flow at the pore scale with a discrete element model of grain mechanics. We simulate the slow injection of a less viscous fluid into a frictional granular pack initially saturated with a more viscous, immiscible fluid. We study the impact of wettability and initial packing density, and find four different regimes of the fluid invasion: cavity expansion and fracturing, frictional fingers, capillary invasion, and capillary compaction. We explain fracture initiation as emerging from a jamming transition, and synthesize the system's behavior in the form of a phase diagram of jamming for wet granular media.