In several geological environments, chemical reactions are coupled to rock deformation and the associated stresses induced locally interact with the far field loading. This is the case in immature shales that undergo burial and diagenesis, where the organic matter evolves with temperature into hydrocarbons which induces local volume expansion. At large scale, this mechanism is responsible for the transport of hydrocarbons from source to reservoir rocks, a process referred to as primary migration. However, how the interactions between local fluid production, microfracturing, and transport are coupled remain to be understood. Here, we analyze this coupling phenomenon by developing a discrete element model where the generation of local overpressures occurring in kerogen patches is simulated, while the surrounding rock is subjected to external loading. It is shown that, due to local fluid overpressure; microfracturing occurs and brings the fluids to migrate through the medium. The numerical results are confirmed by laboratory experiments where the network of microfractures induced in an immature Green River shale sample heated under small differential stress was imaged in three dimensions using X-ray microtomography. Moreover, the numerical simulations identify that the state of differential stress and the initial kerogen distribution constitute two key parameters that control the formation of the three-dimensional percolating microfracture network and could thus explain primary migration in shale rocks.