Superior Court Judge Peter Espinoza said he ruled "in defense of the integrity of the justice system, he needs to surrender."
His ruling is likely to be appealed.
Attorneys for the 76-year-old director have argued their client should be sentenced in absentia to time already served after pleading guilty in 1978 to one count of unlawful sexual intercourse with a 13-year-old girl.
Prosecutors insist Polanski must appear in a Los Angeles courtroom and not be permitted to manipulate the justice system.
Polanski, arrested on a U.S. warrant, spent more than 60 days in a Swiss jail before being transferred to house arrest in his Swiss vacation home Dec. 4.
An attorney for Polanski's victim also urged Espinoza to have the director sentenced in absentia.
Michael Brennan, a law professor at the University of Southern California, said it's highly unusual for a defendant to be sentenced in absentia.
In court documents, Polanski's attorneys said the late Superior Court Judge Laurence J. Rittenband sentenced the director in 1978 to a diagnostic study at a California prison where he served 42 days.
Although the judge told attorneys that would be Polanski's full sentence, he later indicated he was going to renege on the bargain and give him a harsher sentence at a scheduled hearing.
Polanski fled to France and has been a fugitive ever since.
His attorneys said the judge's promise is binding and Polanski has served his full sentence. They have asked Espinoza for a full hearing with witnesses about allegations of judicial and prosecutorial misconduct in the case.
Polanski's victim, Samantha Geimer, was 13 when she met Polanski for a modeling shoot in Los Angeles in 1977. Polanski was accused of plying her with champagne and part of a Quaalude pill then raping her at Jack Nicholson's house.
He was initially indicted on six felony counts, including rape by use of drugs, child molesting and sodomy. He later pleaded guilty to one count of unlawful sexual intercourse.