Constraining the timescales for the assembly and differentiation of planetary bodies in our young solar system is essential for a complete understanding of planet-forming processes. This is best achieved through the study of the daughter products of extinct radionuclides with short half-lives, as they provide unsurpassed time resolution as compared to long-lived chronometers. Here we report high-precision Mg isotope measurements of bulk samples of basalt, gabbro, and pyroxenite meteorites obtained by multiple-collector inductively coupled plasma mass spectrometry (MC-ICP-MS). All samples from the eucrite and mesosiderite parent bodies (EPB and MPB) with suprachondritic Al/Mg ratios have resolvable 26Mg excesses compared to matrix-matched samples from the Earth, the Moon, Mars, and chondrites. Basaltic magmatism on the EPB and MPB thus occurred during the life span of the now-extinct 26Al nuclide. Initial 26Al/27Al values range from (1.26 ± 0.37) × 10-6 to (5.12 ± 0.81) × 10-6 at the time of magmatism on the EPB and MPB, and are among the highest 26Al abundances reported for igneous meteorites. These results indicate that widespread silicate melting and differentiation of rocky bodies occurred within 3 million years of solar system formation, when 26Al and 60Fe were extant enough to induce planetesimal melting. Finally, thermal modeling constrains the accretion of these differentiated asteroids to within 1 million years of solar system formation, that is, prior to the accretion of chondrite parent bodies.