There doesn't appear to be an existing term that neatly fits. Here are some possibilities:
One-word terms:
Traumaraderie (portmanteau of "trauma" and "camaraderie")
Two-word terms:
Stress bonding (a technique for bonding rabbits)
Trauma bonding (this is sometimes used to mean bonding between victims even though it also means bonding between victim and abuser in other contexts)
Trauma kinship
Survivor bond
Longer terms:
Friendship forged in fire
Shared trauma bonding
Mutual suffering solidarity
Camradery through adversity
Is there a idiom or phrase which describes bonding or attachment, not between a victim and an abuser like in Trauma Bonding or Stockholm Syndrome, but between two or more victims: i.e. how would you describe two hostages who forge a friendship or deep connection based on their shared experience? (A common trope of TV show episodes to fast crystalize enemies into friends)
Specifically I'm wondering about a word where they were in the same environment, not sharing similar experiences.