If you want to recover a text message, tap on the thread or message so that it's selected, hit Recover on the bottom right, and then tap Recover Message in the pop-up that appears. You can also ...
You can back up messages on an iPhone to your iCloud account, or sync messages from your iPhone to your Mac.