The warning came as protesters were attacked by unidentified men with machetes in the capital, Abuja.
Demonstrations against police brutality have taken place in cities across Nigeria in the past week.
The protests have continued despite authorities agreeing to disband the Special Anti-Robbery Squad (Sars).
The unit has been accused of extrajudicial killings, extortion and torture, especially of young people.
The government on Thursday announced a ban on all protest in Abuja, saying the demonstrators were violating public safety measures introduced to tackle Covid-19.
What did the army say?
Army spokesman Col Sagir Musa said in a Facebook post: "The NA [Nigerian army] hereby warns all subversive elements and trouble makers to desist from such acts as it remains highly committed to defend the country and her democracy at all cost."
He went on to offer to "support the civil authority in whatever capacity to maintain law and order and deal with any situation decisively".
The statement has been received as a veiled threat by protesters, reports the BBC's Chris Ewokor from Abuja.
What happened with the attack on the protesters?
On Wednesday, protesters against police violence in Abuja were attacked by a group of unidentified men with machetes.
Witnesses said several hundred demonstrators were gathered in the city centre when the attack took place.
One protester said some of the assailants had later been detained and handed over to the authorities.
There are also reports of similar attacks on protesters in Lagos on Thursday.