The inverse transfer of magnetic helicity is investigated through direct numerical simulations of large-scale-mechanically-driven turbulent flows in the isothermal ideal magnetohydrodynamics (MHD) framework. The mechanical forcing is either purely solenoidal or purely compressive and the turbulent steady-states considered exhibit root mean square (RMS) Mach numbers 0.1 M 11. A continuous small-scale electromotive forcing injects magnetic helical fluctuations, which lead to the build-up of ever larger magnetic structures. Spectral scaling exponents are observed which, for low Mach numbers, are consistent with previous research done in the incompressible case. Higher compressibility leads to flatter magnetic helicity scaling exponents. The deviations from the incompressible case are comparatively small for solenoidally-driven turbulence, even at high Mach numbers, as compared to those for compressively-driven turbulence, where strong deviations are already visible at relatively mild RMS Mach numbers M 3. Compressible effects can thus play an important role in the inverse transfer of magnetic helicity, especially when the turbulence drivers are rather compressive. Theoretical results observed in the incompressible case can, however, be transferred to supersonic turbulence by an appropriate change of variables, using the Alfvén velocity in place of the magnetic field.