The magnetic-field stability of a mass spectrometer plays a crucial role in precision mass measurements. In the case of mass determination of short-lived nuclides with a Penning trap, major causes of instabilities are temperature fluctuations in the vicinity of the trap and pressure fluctuations in the liquid helium cryostat of the superconducting magnet. Thus systems for the temperature and pressure stabilization of the Penning trap mass spectrometer ISOLTRAP at the ISOLDE facility at CERN have been installed. A reduction of the fluctuations by at least one order of magnitude downto dT=+/-5mK and dp=+/-50mtorr has been achieved, which corresponds to a relative frequency change of 2.7x10^{-9} and 1.5x10^{-10}, respectively. With this stabilization the frequency determination with the Penning trap only shows a linear temporal drift over several hours on the 10 ppb level due to the finite resistance of the superconducting magnet coils.