You can query for all the contact which are community user as folllowing
List<Contact> lContacts = [SELECT Id FROM Contact];
List<User> lUsers = [SELECT Id,Contact.Id,Name,Email FROM User WHERE Profile.Name = 'Customer Commmunity User' AND ContactId IN :lCont];