Chief U.S. District Judge James Ware agreed with those who sued to overturn Proposition 8 and several media outlets, saying there's no reason to keep the recordings secret.
His order will take effect on Sept. 30 unless a higher court overrules him.
Religious and conservative groups that sponsored the voter-approved ban opposed making the videos public.
They argued that after the U.S. Supreme Court ruled the trial could not be broadcast, the trial judge assured them the recordings were only for his use.
"Today's decision is bizarre for many reasons, but mostly because it defies a direct order of the U.S. Supreme Court," Andy Pugno, general counsel to the Protect Marriage coalition. "We will appeal immediately to the Ninth Circuit and ask them to restore some sanity to this case."
The Associated Press contributed to this report.