Some tablets come with a SIM card which automatically gives you a phone number. However, this is not common and it can be useful to have a phone number to send and receive texts.
There are a number of text services/apps available for android and iPad
On an iPad, try Text Free with Textfree or TextNow Free.
There are a huge number of such apps on android, such as Text Me and TextMeUp:
Having a phone number allows you to send and receive texts and possibly make phone calls, although you would be limited by the nature of your own device.