Research suggests the social, physical, and socioeconomic contexts of residing in segregated neighborhoods may negatively affect mental health. To assess the association between racial residential segregation and prenatal mental health among Asian, Black, Hispanic, and White individuals. This population-based cross-sectional study was conducted in Kaiser Permanente Northern California (KPNC), an integrated health care delivery system. Participants included self-identified Asian, Black, Hispanic, and White pregnant individuals who attended at least 1 prenatal care visit at KPNC between January 1, 2014, and December 31, 2019. Data were analyzed from January 14, 2023, to August 15, 2024. Racial residential segregation, defined by the local Getis-Ord Gi* statistic, was calculated in each racial and ethnic group and categorized as low (<0), medium (0-1.96), or high (>1.96). A positive Gi* statistic indicates overrepresentation (greater clustering or segregation) of the racial and ethnic group in an index census tract and neighboring tracts compared with the larger surrounding geographic area. Prenatal depression and anxiety defined by diagnoses codes documented in the electronic health record between the first day of the last menstrual period and the day prior to birth. Among the 201 115 participants included in the analysis (mean [SD] age, 30.8 [5.3] years; 26.8% Asian, 6.6% Black, 28.0% Hispanic, and 38.6% White), prenatal depression and anxiety were highest in Black individuals (18.3% and 18.4%, respectively), followed by White (16.0% and 18.2%, respectively), Hispanic (13.0% and 14.4%, respectively), and Asian (5.7% and 6.4%, respectively) individuals. Asian (40.8% vs 31.1%) and Black (43.3% vs 22.6%) individuals were more likely to live in neighborhoods with high vs low segregation, while Hispanic individuals were equally likely (34.3% vs 34.7%). High compared with low segregation was associated with greater odds of prenatal depression (adjusted odds ratio [AOR], 1.25 [95% CI, 1.10-1.42]) and anxiety (AOR, 1.14 [95% CI, 1.00-1.29]) among Black individuals. High segregation was associated with lower odds of prenatal depression among Asian (AOR, 0.75 [95% CI, 0.69-0.82]), Hispanic (AOR, 0.88 [95% CI, 0.82-0.94]), and White (AOR, 0.91 [95% CI, 0.86-0.96]) individuals. Similar associations were found for anxiety among Asian (AOR, 0.80 [95% CI, 0.73-0.87]) and Hispanic (AOR, 0.88 [95% CI, 0.82-0.93]) but not White (AOR, 0.95 [95% CI, 0.90-1.00]) individuals. In this cross-sectional study, racial and ethnic residential segregation was associated with worse prenatal mental health for Black individuals but better mental health for Asian, Hispanic, and White individuals. Policies reducing segregation and its impact may improve mental health outcomes in pregnant Black individuals.