UPDATED 9th October 2013 to include iOS 7 and sending group text messages
Create groups on iOS devices with iCloud
Some groups are created by default, such as the All Contacts group, which can't be deleted. Other groups could include Gmail contacts (created when you add your Gmail account in the Mail app) and Facebook.
Unfortunately, and this is probably the reason you're reading this, Apple doesn't provide a way to create new groups within iOS (and the feature is still missing in iOS 7), so you can't do it directly on your iPhone or iPad.
The answer - one method, at least - is to use iCloud.
How to use iCloud to create contact groups
Step 1. Log into www.icloud.com using your Apple ID.
Step 2. Click on Contacts and then click the + icon at the bottom. Choose New Group from the menu that pops up.
Step 3. Type a name for the new group and click outside the box to save it..
Step 4. To add contacts to the new group, click on the All Contacts group and locate the first person to be added (you can use the search bar to find them quickly).
Step 5. Drag their name on top of the new group and drop it to add it to that group.
Step 6. To add more contacts, repeat step 5, but you can add multiple contacts at once by pressing Ctrl (on a PC) or Command (on a Mac) and clicking on each contact in the list that you wish to select. Then, drag one of the highlighted names to the new group and they will all be added.
It's possible to add names to more than one group, and you can create as many groups as you like.
Step 7. Launch the Contacts app on your device (iPhone, iPod touch or iPad), tap Groups (top left) and the new group should be there - as long as you have an internet connection and iCloud enabled (check in Settings > iCloud).
Until Apple builds in a function to create groups directly within the Contacts app, this is the best way to do it.
How to send text messages to a group of contacts
One of the main problems people have after creating groups is that there's still no way to select that group when sending a message (either an SMS or iMessage). You can only see the list of contacts within that group and add them individually.
The only solution is to install a third-party app from the App Store. One you can try is Text2Group (currently 69p). This allows you to do what Apple still refuses to let you, even in iOS 7. Note that if you want to send text messages (SMS) to non-iOS devices, you need to disable iMessage, MMS and Group Messaging in the Settings.
That means it isn't the greatest option if you want to continue to use iMessage - it's more of a workaround.