Judge Susan Illston made that warning at a hearing Tuesday where she heard arguments on the final series of pre-trial motions. She asked Bonds' childhood friend and long time trainer Greg Anderson what his intentions are. Will he testify in court?
Anderson told the court through his lawyer that he will not testify against the baseball star. Anderson already spent more than a year in prison for refusing to testify before a grand jury investigating Bonds.
Illston told him he would be jailed again for the duration of the trial on contempt charges if he did not change his mind.
Anderson's attorney Mark Geragos says he may be able to prevent that.
"I believe there's a legal bar for them being able to put him back in; we'll address that on the 22nd," Geragos said.
In a separate hearing, Bonds pleaded not guilty to revised perjury charges. There are four counts of making false statements to a grand jury and one count of obstructing justice.
Bonds told the grand jury he never knowingly got steroids from Anderson.
The judge also turned down most of the final pre-trial motions filed by the defense which would have limited testimony by prosecution witnesses.
One of them is Bonds' ex-girlfriend Kimberly Bell, who says he once attacked her.
"Kim Bell, Bonds' ex-girlfriend, says he wrapped his hands around her neck and threatened to kill her one time and the defense really didn't want that in front of the jury, but the judge said its coming in," Lance Williams, an investigative reporter who wrote a book about the scandal, said.
Bonds' lawyers say that charge of domestic violence would unfairly prejudice jurors.
"That accusation is false and it's very inflammatory and there are a lot of people rightfully who have strong feelings about domestic violence," attorney Cris Arguedas said.
Prosecutors have changed their indictment four times. In this final version they dropped six of the 11 felony counts against Bonds.
Bonds' perjury trial is set to begin March 21. The trial is expected to last about two weeks.