What happened, via The Atlantic:

On Twitter Tuesday night, political operatives and journalists [in D.C. and surrounding area] reported receiving spam texts attacking President Obama. The texts come not from phone numbers but from email addresses, most with mysterious domains: sms@gopmessage.com, sms@votegopett.com, sms@voteett.com. According to Whois.com… those domains were all registered in February, but the registrant’s name is blocked.

Was it legal? Yes, although perhaps not free to the recipient, according to Huffington Post: