Plainclothes police officers dragged away cameramen from news organisations, including Reuters and Al Jazeera television, and confiscated their cameras.
Two of the Al Jazeera team were beaten - Yasir Suleiman, a cameraman, and Nasri Yousif, a soundman.
Suleiman said he and other journalists were barred from entering the Supreme Court building in Cairo to cover the hearing.
"We learned that the protesters had moved to a street behind the building, so we moved with our equipment to cover the protest. Suddenly, six security men attacked me, trying to take my camera.
"When I refused, they started beating me. They tried to arrest me in a nearby building. ... I also resisted, so they took the camera by force from me," he said.
Suleiman said the security forces returned the camera but confiscated the tape.
Police also dragged 15 demonstrators from a crowd of about 300 protesting in support of the judges and beat them.
Other demonstrators dispersed when the security forces began their crackdown. The demonstrators included supporters of the opposition Muslim Brotherhood and secular activists.
"Judges, judges save us from the tyrants," they chanted as they marched through central Cairo.
Two judges are facing charges of
violating Egyptian judiciary rules
Several hundred protesters from the Brotherhood, the Kefaya movement and leftist organisations gathered in central Cairo and were surrounded by thousands of police officers.
"Dozens of members of the Muslim Brothers were arrested," the opposition Islamist movement's spokesman Issam al-Aryan said.
Large parts of central Cairo were sealed off to traffic.
The two judges, Mahmoud Mekky and Hesham Bastawisi, refused to enter the courtroom, saying that their defence team was not allowed to come with them.
Mekky and Bastawisi face charges of violating judiciary rules by talking about abuses in last year's elections.
Karima al-Hafnawi, a member in the Kifaya opposition movement who participated in the demonstrations, spoke on the phone with Al Jazeera.
"The authorities have refused to allow Zakaria Abd al-Aziz, the defence lawyer, from attending the court session, and the two judges [Mekky and Bastawisi] refused to stand before the court panel," she said.
She said the protesters tried to move several times to avoid the police, but they were chased.
A police officer kicks a
protester at Thursday's rally
"When we started to relocate ourselves, they [police] started to beat media crews and arrested several Kifaya members like Muhammad Abd al-Qudous and Muhammad Hashim," she said.
Thousands of riot police had deployed in central Cairo in anticipation of the demonstration.