The recent emergence of electromagnetic topological defects has attracted wide interest in fields from topological photonics to deep-subwavelength light-mater interactions. Previously, much of the research has focused on constructing specific topological defects but the fundamental theory describing the physical mechanisms underlying their formation and transitions is lacking. Here, we present a spin–orbit coupling based theory describing such mechanisms for various configurations of spin topological defects in confined electromagnetic fields. The results reveal that their formation originates from the conservation of total angular momentum and that their transitions are determined by anisotropic spin–orbit couplings. By engineering the spin–orbit couplings, we observe the formation and transitions of Neél-type, twisted-type, and Bloch-type spin topological defects in confined electromagnetic fields. A stable Block-type spin topological defect is reported for the first time. Our theory can also describe the transitions of field topological defects. The findings enrich the portfolio of electromagnetic topological defects, deepen our understanding of conserved laws, spin–orbit couplings and transitions of topological defects in confined electromagnetic systems, and predict applications in high-density optical data transmissions and chiral quantum optics.