You are looking for IDP Attribute mapping. In the IDCloud version, I would recommend to check this URI for documentation. And if you are following that guide, you would need to inject the user group information in one of your mappings. For example, reading ismemberof virtual attribute from the profile and mapping it to the outgoing role attribute.
You will need to define a custom SAML2 IDP Attribute Mapper script. Use below script as an example,