In a project I am currently working on there is a facility for Umbraco users to export Membership and Profile data. As part of the export the client also wanted to include the groups a member belongs to and here is how I achieved it, I hope it is of use to someone else.
[code language="c#"]Member m = new Member(mid);
// Loop through the member groups and add them to the field
foreach (MemberGroup mg in m.Groups.Values)
{
//- Do your stuff in here, e.g.
csv.Append(mg.Text); // Appends the Member group name
}[/code]