According to the Hamas interior ministry spokesman Ehab Ghussein, Martin was suspected of harming Gaza's security.
The journalist went to the military court to speak on behalf of Mohammed Abu Muailik, whom he has been working on for a documentary.
Muailik is a Gaza man accused of collaborating with Israel. He has been in detention since June.
Ehab Jaber, the lawyer of Abu Muailik, said the policemen were rough with Martin. This is an unprecedented step against a foreigner since the Islamist group took over the territory in 2007.
The spokeswoman for the British consulate in Jerusalem said the British government was in touch with Martin's family.
Raji Sourani, a prominent human rights lawyer in Gaza, is likely to represent Martin.