by Alfonso Rivero.
I've found the solution.
Left the comment here for reference to somebody with the same problem.
To add a member to a group, the user must be enroled in the course the groups belongs to.