Adverse childhood experiences (ACE) have been linked to less prosocial behavior during social exclusion in vulnerable groups. However, little is known about the impact of the timing of ACE and the roles of protective factors. Therefore, this study investigated the association of the behavioral response to experimental partial social exclusion with adverse and adaptive experiences across age groups and resilience in clinical groups with persistent depressive disorder and borderline personality disorder, i.e., groups with high ACE, and in healthy controls (HC) (N = 140). Adverse and adaptive experiences during childhood, youth, and adulthood were assessed with the Traumatic Antecedents Questionnaire, and resilience was measured with the Connor Davidson Resilience Scale. A modified version of the Cyberball paradigm was used to assess the direct behavioral response to partial social exclusion. In patients, adverse events during youth (B = − 0.12, p = 0.016) and adulthood (B = − 0.14, p = 0.013) were negatively associated with prosocial behavior, whereas in the HC sample, adaptive experiences during youth were positively associated with prosocial behavior (B = 0.25, p = 0.041). Resilience did not mediate these effects. The findings indicate that critical events during youth may be particularly relevant for interpersonal dysfunction in adulthood.