The deal, announced at a joint news conference in Gaza on Wednesday, falls short of a Palestinian Authority plan for militants to put all their weapons into storage during the 25 January parliamentary election.
Fears of chaos and lawlessness in Gaza have grown since Israel's withdrawal last September intensified a power struggle among armed factions and security forces.
Fatah's Samir al-Mashharawi said the agreement with Hamas included "all forms of armed displays," and would apply both to faction leaders and their bodyguards.
Bitter campaign rivals, Fatah and Hamas said they agreed to cooperate and support efforts by Palestinian security services to secure polling stations.
Fatah is widely expected to lose ground in the election to Hamas, which is riding a wave of popularity among Palestinians because of its corruption-free reputation and extensive charity network.
It was unclear whether the arms deal would be enough to secure calm. In the past, factions have ignored appeals from Abbas not to parade their arms in public.
Storage plan rejected
Earlier this week, resistance groups rejected a plan by the Palestinian Authority to put their weapons into storage immediately before and after the 25 January election.
The groups also turned down an offer for police protection that would have required keeping armed escorts at home.
Violence in the run-up to the election has come as an embarrassment to Abbas. Many armed protests and abductions have involved gunmen from his ruling Fatah movement, some of whom want the poll delayed.
The Palestinian Authority wants a state in the West Bank and Gaza Strip with East Jerusalem as its capital.
Those territories were captured and occupied by Israel in the 1967 Middle East war.