There is a similar question here: assign a client to multiple customer groups in magento .
However, I'm not sure if the answer provided is universal, because the following snippet
$customer->getGroupId()
it is used quite a lot in the Magento kernel, where it is also assumed that the group identifier returned from this method is an integer, not a string (a list of identifiers separated by commas).
source share