The Peierls instability toward a charge density wave is a canonical example of phonon-driven strongly correlated physics and is intimately related to topological quantum matter and exotic superconductivity. We propose a method to realize an analogous photon-mediated Peierls transition, using a system of one-dimensional tubes of interacting Bose or Fermi atoms trapped inside a multimode confocal cavity. Pumping the cavity transversely engineers a cavity-mediated metal--to--insulator transition in the atomic system. For strongly interacting bosons in the Tonks-Girardeau limit, this transition can be understood (through fermionization) as being the Peierls instability. We extend the calculation to finite values of the interaction strength and derive analytic expressions for both the cavity field and mass gap. They display nontrivial power law dependence on the dimensionless matter-light coupling.