We introduce configuration space as a natural representation for calculating the mechanical relaxation patterns of incommensurate two-dimensional (2D) bilayers. The approach can be applied to a wide variety of 2D materials through the use of a continuum model in combination with a generalized stacking fault energy for interlayer interactions. We present computational results for small-angle twisted bilayer graphene and molybdenum disulfide (MoS2), a representative material of the transition-metal dichalcogenide family of 2D semiconductors. We calculate accurate relaxations for MoS2 even at small twist-angle values, enabled by the fact that our approach does not rely on empirical atomistic potentials for interlayer coupling. The results demonstrate the efficiency of the configuration space method by computing relaxations with minimal computational cost. We also outline a general explanation of domain formation in 2D bilayers with nearly aligned lattices, taking advantage of the relationship between real space and configuration space. The configuration space approach also enables calculation of relaxations in incommensurate multilayer systems.