Laughter is a social behavior that helps to bond people together and establish social hierarchies. It cannot be understood outside the social context in which it occurs.
Sharing a joke or a humorous experience can create a sense of connection and shared understanding between individuals.
When we laugh at a joke or humorous situation, we are signaling to others that we get the message and share in the emotional experience. This can create a sense of solidarity and belonging, which may have been essential for our ancestors who relied on strong social bonds for survival in a dangerous world.
However, humor is also heavily based on aggression and may have evolved in part through sexual selection pressures.