Well, he fled the night before sentencing after meeting with his lawyer. This was subsequent to the psych eval (required by CA law at the time) that reccomended no prison and subsequent to the ADA (Gunnson, IIRC) stating he was recommending time served based on the evaluation, etc. Although there is speculation, it appears that Gunnson (or perhaps the girl's family atty) contacted Polanski's atty after he found out another ADA (not connected to the case) was earwigging the judge to sentence Polanski to prison. And info that the Judge had aspirations of a book/TV deal since he was getting ready to retire and wanted to parlay his eye in the public spotlight over the case into financial gain.
If true it certainly brings into play Higgins' sugestion that the Judge and DA's office were acting improperly...in any event someone tipped off Polanski's lawyer and the rest is history.
So in a sense the plea bargain had been struck with no set sentence and as is always the case the judge didn't have to accept it. In fact, Polanski could have withdrawn his plea prior to sentencing but had he the apparently biased and personally ambitious judge would have really hammerted him.
Here's a link to the transcript of the plea if you're interested:
http://www.thesmokinggun.com/archive/years/2009/0928091polanskiplea1.html