An announcement on military-run television said martial law had been invoked "to restore peace and order for people from all sides", stressing that the move "is not a coup".
"The public do not need to panic but can still live their lives as normal," it added.
The move, which gives the military control of nationwide security rather than the police, risks angering supporters of the government if it is seen as tantamount to a coup.
Chaikasem Nitisiri, the justice minister, told the Associated Press news agency the army had not consulted the cabinet.
He played down the move, saying the caretaker government was still running the country but that the army was now in charge of security.
"Security matters will be handled solely by the military, and whether the situation intensifies or is resolved is up to them," he said.
"There is no cause to panic. Personally, I welcome the move."
Al Jazeera's Scott Heidler, reporting from Bangkok, said the measure was taken to prevent more flare-ups of violence between rival protesters.
He said soldiers had been deployed to areas where there were anti- or pro-government protesters and that the army had been given the authority to break up gatherings of more than five people, although it did not say it would do so.
Soldiers were seen in the heart of the city's retail and hotel district and also entered private television stations to broadcast their message.
They also surrounded the national police police headquarters in the city centre, AP reported.
But the vast skyscraper-strewn city of 10 million people remained calm, with schools open and commuters driving and walking to work, AP added.
The dismissal of Prime Minister Yingluck Shinawatra earlier this month in a controversial court ruling has raised tensions in the country, which has endured years of political turmoil.