The response "will be harsh if we feel that elements within Hamas or other parties are trying to attack Egyptian national security," Fahmy said in an interview with pan-Arab daily al-Hayat published Tuesday.
It would include "military and security choices and not options that would cause Palestinian citizens to suffer," said Fahmy, who is in New York attending the UN General Assembly meeting.
Ties between Cairo and Hamas have deteriorated since the army ousted Islamist President Mohamed Morsy in July. Morsy belongs to the Muslim Brotherhood which is affiliated with Hamas.
The Palestinian movement fears that Egypt's destruction of tunnels used to smuggle goods into Gaza is part of a plan to tighten a blockade of the enclave.
The Egyptian army has said the destruction of the tunnels is part of a crackdown against Islamist militants in the Sinai peninsula who have links to extremists in Gaza.
Meanwhile, Fahmy said relations between Cairo and Washington were "troubled" and that he had told his U.S. counterpart, John Kerry, that threats of suspending U.S. aid to Egypt will have no "influence" on the new army-installed authorities.
Washington is officially reviewing $1.55 billion in annual military and economic aid to Egypt as a result of Morsi's ouster.
On Tuesday, U.S. President Barack Obama warned that continued US support for Egypt depends on its progress back to democracy.
Obama insisted at the annual General Assembly that the United States had "purposely avoided choosing sides" after Morsi was overthrown, but warned that "our support will depend upon Egypt's progress in pursuing a democratic path."