Is it legal to fire someone over a text message?
It most likely is. The reason is that most employment relationships are what is known as "at will". This means that you can work for an employer, or not, your choice. In turn, the employer can hire or fire you for any reason or no reason whatsoever. Unless there is a term of employment providing otherwise, such as an employment or union contract, official company policy or discrimination is somehow in play here.