The comments by army chief Gen Abdel-Fattah al-Sisi came a week ahead of planned mass protests by opponents of Islamist President Mohammed Morsi.
He said the army was obliged to stop Egypt plunging into a “dark tunnel”.
The remarks are seen as one of the strongest interventions since the army handed over power to President Morsi last year.
Consensus plea
At a meeting with soldiers on Sunday, Gen Sisi, who is also the country’s defence minister, said the army would “not remain silent as the country slides into uncontrollable conflict”.
“There is a state of division in the society, and the continuation of it is a danger to the Egyptian state.
“There must be consensus,” he stressed.
Gen Sisi also met the president on Sunday for what an army spokesman described as a “routine” consultation, according to Reuters news agency.
Gen Sisi’s comments come as Egypt’s secular groups plan mass rallies ahead of the 30 June anniversary of President Morsi coming to power.
The groups say they have gathered 13 million signatures on a petition calling for the Islamist leader to step down.
On Friday, thousands of Mr Morsi’s supporters marched across the country – in a show of support for the president.
The crowds chanted their allegiance, pre-empting the opposition demonstrations.
Mr Morsi’s first year in office has been marred by constant political unrest and a sinking economy.
Many analysts say the instability and a continuing threat of violence have frightened away foreign investors and tourists.
There is increasing unemployment, particularly among the young, fuel shortages and a drain on reserves of foreign currency