Pregnancy is associated with elevated demand of most nutrients, with many trace elements and minerals critical for the development of fetus. In particular, calcium (Ca2+) and magnesium (Mg2+) are essential for cellular function, and their deficiency can lead to impaired fetal growth. A key contributor to the homeostasis of these ions is the kidney, which in a pregnant rat undergoes major changes in morphology, hemodynamics, and molecular structure. The goal of this study is to unravel the functional implications of these pregnancy-induced changes in renal handling of Ca2+ and Mg2+, two cations that are essential in a healthy pregnancy. To achieve that goal, we developed computational models of electrolyte and water transport along the nephrons of a rat in mid and late pregnancy. Model simulations reveal a substantial increase in the reabsorption of Mg2+ along the proximal tubules and thick ascending limbs. In contrast, the reabsorption of Ca2+ is increased in the proximal tubules but decreased in the thick ascending limbs, due to the lower transepithelial concentration gradient of Ca2+ along the latter. Despite the enhanced transport capacity, the marked increase in glomerular filtration rate results in elevated urinary excretions of Ca2+ and Mg2+ in pregnancy. Furthermore, we conducted simulations of hypocalcemia and hypomagnesemia. We found that hypocalcemia lowers Ca2+ excretion substantially more than Mg2+ excretion, with this effect being more pronounced in virgin rats than in pregnant ones. Conversely, hypomagnesemia reduces the excretion of Mg2+ and Ca2+ to more similar degrees. These differences can be explained by the greater sensitivity of the calcium-sensing receptor (CaSR) to Ca2+ compared with Mg2+.NEW & NOTEWORTHY A growing fetus' demands of minerals, notably calcium and magnesium, necessitate adaptations in pregnancy. In particular, the kidney undergoes major changes in morphology, hemodynamics, and molecular structure. This computational modeling study provides insights into how these pregnancy-induced renal adaptation impact calcium and magnesium transport along different nephron segments. Model simulations indicate that, despite the enhanced transport capacity, the marked increase in glomerular filtration rate results in elevated urinary excretions of calcium and magnesium in pregnancy.