The incident at the Celio military hospital, now turned into a Covid-19 treatment centre, occurred when they saw a Bangladeshi migrant walking out after testing negative and then tried to flee but were stopped.
They are accused of violence, resistance and causing bodily harm.
“The attacks at the military hospital are serious and unacceptable,” Defence Minister Lorenzo Guerini said.
The incident was seized upon by Italy's anti-immigration former interior minister Matteo Salvini who said the government was putting “Italy in danger”.
Migration has for years been a hot-button political issue in Italy, a main EU landing point for people crossing the Mediterranean and arriving in Sicily and sister island Lampedusa.