Ultrahigh energy protons in magnetic fields produce pions and thus lose energy. The mean free path of such a process is worked out for Gaussian random fields. Two cases are considered: an isotropic and a cylindrically symmetric distribution. The energy loss is proportional to E^3 <B^2>; it becomes significant for protons of energies larger than about 10^19 eV and magnetic fields of about 10^9 Gauss. For energies and magnetic fields of this magnitude, a proton injected into the magnetic field loses a substantial fraction of its initial energy due to pion production.