Just like for FaceTime, the first step is to create an Apple ID if you haven't already. Click here to create an Apple ID online, or create one on your iOS device by going to Settings > iCloud > Create a new Apple ID.
Next, go to Settings > Messages and turn on iMessage, using the switch at the top of the page. (If the switch is green, it's already on!) Keep the Send As SMS switch off, as seen below:
Next, tap on Send & Receive, which will bring you to the Send & Receive page. Under the Start New Conversations heading, choose the email address associated with your Apple ID. If there's a phone number listed, don't use that - it has to be the email linked to your Apple ID.
Like FaceTime, iMessage can only be used between two people with Apple IDs. You can't use iMessage to text a person who doesn't have an Apple ID.