You can add contacts to case teams, but they can only access cases when they’re enabled as customer portal users assigned to case page layouts.
Visible In Customer Portal
If you want members in the role visible to customer portal users viewing cases, choose Visible in Customer Portal. Even if Visible in Customer Portal isn’t chosen, customer portal users added to case teams can view themselves on Case Team related lists.
Case Team access for Contacts applies specifically to ‘Customer Portal Users’ which are associated with a unique, legacy license type. ‘Customer Community’ Users and ‘Customer Portal’ Users, while similar, are not the same.
Vote for this idea for Customer Community licenses – https://trailblazer.salesforce.com/ideaView?id=08730000000DlPpAAK.