As a black person who has worked at multiple tech companies with ERGs, I can tell you this is a very weird, uninformed assumption to make. Participation has always been optional (some places/some times I've been too busy to even acknowledge the groups, and in others I've actively helped organize events, and get people resources, etc).
No one is harassed, derided, or ridiculed for not participating.
As for what happens in those groups - since it doesn't seem like you've ever been a part of one, but I may be wrong - they organize events (during black history month, hispanic heritage month, pride month, women's history month, etc). Typically everyone in the organization is invited to those events - even if you're not a member of the group or the groups demographic. They also organize other events, volunteer/donation drives throughout the year. Help other groups, and help employees navigate issues in the workplace they may not be ready to talk to their leaders/HR about yet.
If you're ever genuinely curious, reach out to any group in your work, make a good faith request to understand them, and I'm certain they'll be more than happy to talk to you about what they get up to.