Transitioning into motherhood can be stressful and resource-intensive, filled with numerous concerns and uncertainties during pregnancy, such as biological changes and unforeseen outcomes. Expectant mothers, those lacking prior motherhood experience, frequently seek solace within online communities, utilizing them as sources of social support to navigate the complexities of the first-time motherhood experience and to facilitate the exploration of their life-role transition. Drawing on role theory, conservation of resources theory, social support research, and socialization literature, this study explores how online communities can provide social resources for expectant mothers to facilitate their role learning, and examines the antecedents and outcomes of role learning. Based on a two-wave survey of 185 expectant mothers (pregnant with their first child), the results show that online community resources (i.e., informational support, emotional support, and social companionship) positively impact role learning (conceptualized as a higher-order factor, including role meaning, role competence, and role internalization), and role learning significantly enhances their subjective well-being. Moreover, role learning fully mediates the links between each type of social support and subjective well-being. A better understanding of the social support mechanisms involved in role learning may empower healthcare providers to leverage the capabilities of social media, thereby offering effective guidance to pregnant women confronting uncertainties in their transition to new life-roles.