If the messages have been saved on a backup service such as iTunes or iCloud, the text messages may be retrieved at the cost of some data loss. Disable synchronization on the backup program, and download the data back onto the phone to retrieve the lost text messages for reading.
In the absence of backup software, deleted text messages are retrieved by third-party software. A program searches for texts or all of the phone's data, depending on which program is searching. Depending on the amount of data on the phone, this can take anywhere from a couple seconds to several minutes to complete. Programs that retrieve deleted text messages in this manner just retrieve the text data that remains on the phone, so they are not a guarantee that the data can still be retrieved. If a phone has been synchronized or restored to a backup version, all of that data could be gone forever.
Android phones go through a similar process. In order to perform this process, the phone must be set to USB debug mode for the programs to retrieve the data successfully. This allows for downloading the data directly onto a PC to browse through the data, even data that was previously deleted and scheduled for overwriting as a result. Deleted text messages that are too old are going to be saved over, making them impossible to retrieve.