  The X-ray and $\gamma$-ray emission of globular clusters (GCs) is attributed
to their large fraction of compact binary systems, especially those with
millisecond pulsars (MSPs). We analyze a population of 124 Galactic GCs to
investigate how their dynamical properties affect the formation and evolution
of compact binary systems and how this can be translated into the clusters'
observed X-ray and $\gamma$-ray emission. We use mainly Chandra X-ray
Observatory and Fermi Large Area Telescope observations to achieve our goals
and start by detecting 39 GCs in $\gamma$ rays, seven of which are not listed
in previous Fermi-LAT catalogs. Additionally, we find that the total number of
X-ray sources within a GC and its $\gamma$-ray luminosity are linearly
correlated with the stellar encounter rate, indicating that compact binary
systems are mainly formed via close stellar encounters. We also find an
unexpected rise in the number of X-ray sources for GCs with low rates of
stellar encounters, suggesting that there is a dynamical threshold where the
formation of X-ray sources is dominated by stellar encounters. Furthermore, we
use the Heggie-Hills law to find that subsequent stellar encounters in these
compact binaries will, on average, make the binaries even harder, with
basically no possibility of binary ionization. Finally, we find that all GCs
are point-like sources in $\gamma$ rays, indicating that the MSPs are
concentrated in the clusters' cores, likely due to dynamical friction.
