Yukawa interactions can mediate relatively long-range attractive forces between fermions in the early universe. Such a globally attractive interaction creates an instability that can result in the growth of structure in the affected species even during the radiation dominated era. The formation and collapse of fermionic microhalos can create hot fireballs at the sites of the collapsing halos which inject energy into the cosmic plasma. We show that the injected energy can be partially converted into primordial magnetic fields and we estimate the correlation scale and the power spectrum of these fields. We show that they may be the seeds of the observed astrophysical magnetic fields.