Divalent cations, especially Ca2+and Mg2+, play a vital role in the function of biomolecules and making them important to be constituents in samples for in vitro biophysical and biochemical characterizations. Although lipid nanodiscs are becoming valuable tools for structural biology studies on membrane proteins and for drug delivery, most types of nanodiscs used in these studies are unstable in the presence of divalent metal ions. To avoid the interaction of divalent metal ions with the belt of the nanodiscs, synthetic polymers have been designed and demonstrated to form stable lipid nanodiscs under such unstable conditions. Such polymer-based nanodiscs have been shown to provide an ideal platform for structural studies using both solid-state and solution NMR spectroscopies because of the near-native cell-membrane environment they provide and the unique magnetic-alignment behavior of large-size nanodiscs. In this study, we report an investigation probing the effects of Ca2+and Mg2+ions on the formation of polymer-based lipid nanodiscs and the magnetic-alignment properties using a synthetic polymer, styrene maleimide quaternary ammonium (SMA-QA), and 1,2-dimyristoyl-sn-glycero-3-phosphocholine (DMPC) lipids. Phosphorus-31 NMR experiments were used to evaluate the stability of the magnetic-alignment behavior of the nanodiscs for varying concentrations of Ca2+or Mg2+at different temperatures. It is remarkable that the interaction of divalent cations with lipid headgroups promotes the stacking up of nanodiscs that results in the enhanced magnetic alignment of nanodiscs. Interestingly, the reported results show that both the temperature and the concentration of divalent metal ions can be optimized to achieve the optimal alignment of nanodiscs in the presence of an applied magnetic field. We expect the reported results to be useful in the design of nanodisc-based nanoparticles for various applications in addition to atomic-resolution structural and dynamics studies using NMR and other biophysical techniques.