A key stage in planet formation is the evolution of a gaseous and magnetized solar nebula. However, the intensity of the nebular field, the lifetime of the nebula, and the history of mass transport in the early solar system have been poorly constrained. Here we present analyses of the remnant magnetization in several meteorite groups demonstrating that an approximately Earth-strength nebular magnetic field existed in the inner solar system (<3 AU) during the first 1-3 My after solar system formation. Meanwhile, measurements from the Philae lander on the surface comet 67P Churyumov-Gerasimenko suggest that the outer solar system (i.e., 14-45 AU) field was near-zero at the same time. The inner solar system field then declined to near-zero by ~4 My after solar system formation, indicating that the solar nebula field, and likely the nebular gas, had dispersed by this time. This sets the timescale for formation of the gas giants and disk-driven planet migration and supports the hypothesis that giant planets form by a two-stage process involving formation of a rock-ice core followed by runaway gas accretion. Finally, our recent measurements of that two unusually volatile-rich carbonaceous meteorites find that they record weak field conditions during the lifetime of the nebula, suggesting that their materials formed at ~10-30 AU from the early Sun. This provides evidence for large-scale dynamical mixing of solids in the solar system and indicates that we may have rock samples from the proto-Kuiper belt.