We study the supercurrent in quasi-one-dimensional Josephson junctions with a weak link involving magnetism, either via magnetic impurities or via ferromagnetism. In the case of weak links longer than the magnetic pair-breaking length, the Josephson effect is dominated by mesoscopic fluctuations. We establish the supercurrent-phase dependence I (φ ) along with statistics of its sample-dependent properties in junctions with transparent contacts between leads and link. High transparency gives rise to the inverse proximity effect, while the direct proximity effect is suppressed by magnetism in the link. We find that all harmonics are present in I (φ ) . Each harmonic has its own sample-dependent amplitude and phase shift with no correlation between different harmonics. Depending on the type of magnetic weak link, the system can realize a φ0 or φ junction in the fluctuational regime. Full supercurrent statistics is obtained at arbitrary relation between temperature, superconducting gap, and the Thouless energy of the weak link.