The rapid solidification process is relevant to many emerging metallurgical technologies. Compared with conventional solidification processes, high-density microstructure defects and residual thermal stress are commonly seen in rapidly solidified metals. Among the various defects, potentially beneficial twin boundaries have been observed in the rapidly solidified nanocrystalline microstructures of many alloy systems. In this work, a pathway for forming twin boundaries in rapid solidification processes is proposed. A detailed derivation of strain inhomogeneities upon thermal shrinkage and the deformation twinning phase field method is given. By calculating cooling-induced thermal strain inhomogeneity in nanocrystalline metals and growth thresholds for deformation twinning using the phase field method, it is shown that residual thermal strain hotspots in the microstructure can reach the threshold for deformation twinning when the shear elastic property of grain boundaries is significantly different from the bulk.