Simply opening and reading a text message will not infect your phone. However, you can get malware if you follow a link to a compromised website or, even worse, download an infected attachment. Text messages are just one-way criminals trying to convince people to download malware. When in doubt, don't download unknown attachments or click on strange links, and delete messages containing them from your phone.