Microwave cavities with high quality factors enable coherent coupling of distant quantum systems. Virtual photons lead to a transverse exchange interaction between qubits, when they are non-resonant with the cavity but resonant with each other. We experimentally probe the inverse scaling of the inter-qubit coupling with the detuning from a cavity mode and its proportionality to the qubit-cavity interaction strength. We demonstrate that the enhanced coupling at higher frequencies is mediated by multiple higher-harmonic cavity modes. Moreover, in the case of resonant qubits, the symmetry properties of the system lead to an allowed two-photon transition to the doubly excited qubit state and the formation of a dark state.