Mohamed Morsi participated in noon prayers among hundreds of officers and soldiers at Cairo Central Security Forces headquarters, Ahram Online reported.
He praised the efforts of police and military personnel.
"Beware, our outside enemy is seeking to create division among us, and we must not allow it," he said. "Any obstacles you're facing, we will get through them -- together."
Morsi's comments came after the removal of CSF head Maged Nouh last week and police strikes across the country.
More than 30 police stations were closed last week to protest the way Interior Minister Mohamed Ibrahim operates. Police officers want the ministry to properly outfit them for riot situations, and they seek Ibrahim's dismissal.
"You are the watchful eye of the homeland. The country's best interest needs your efforts and sacrifices," Morsi told the officers and soldiers. "You all know that our Egypt is going through a critical period, but with the aid of God and cooperation of the police and military we will be able to pass through this phase."
Benedict Cumberbatch's dramatic reading of R. Kelly lyrics is just what you need
Gal Gadot cast as Wonder Woman for 'Batman vs. Superman'