The courts convicted the PM of corruption, and kicker her and half her cabinet out. In an unrelated action she had previously dissolved parliament and made herself "caretaker" PM pending elections. The elections were sure to re-elect her, but protesters blocked enough polling places that the courts ruled the election invalid and the election commission set a date in late July to try again. And then decided that was too soon.
The head of the army stayed neutral through all this, but he finally ran out of patience. He declared martial law, had the army shut down the protest sites and send everyone home, took over all the TV stations and severely restricted the newspapers. Internet is still mostly open, but seems to me to have been slowed down dramatically.
He ordered both protest sides and the acting government leaders to come to a military base to hold talks and try to resolve the crisis. After two days, there was no headway so he had them all taken to another barracks, fired them all, and declared himself acting PM until someone neutral could be identified.
There is also a 10 pm curfew, 9 pm for massage parlors.
My impression is he wants to be in charge of the government about as much as General Sherman (I will not accept if nominated, and will not serve if elected) did. The main idea behind this is to stop the senseless killings, and the big hit the economy is taking with all those people not working, blocking traffic and getting in the way of businesses. And perhaps he hopes to put an end to the massive greed and corruption in parliament and establish free and fair elections.
Thailand has a cycle which dates back to the early 70s of the military taking over, holding elections, seeing democracy fail, and taking over again. When I was there in 1976, it was a very bloody coup, thousands of citizens were killed. The last two have been bloodless.
Friends in Thailand tell me they are fine, especially the foreigners. This coup is all about locals misbehaving, visitors aren't being hassled except for the curfews.