The judge also said Mr Depp should not try to contact Ms Heard.
On Monday, she filed for divorce from the Pirates of the Caribbean actor after 15 months of marriage, citing irreconcilable differences.
Ms Heard brought a photograph of herself with a bruised cheek and eye to the Los Angeles Superior Court.
"I live in fear that Johnny will return to (our house) unannounced to terrorise me, physically and emotionally,`` Ms Heard wrote in a sworn declaration.
She said the actor was high on drugs and drunk when the incident occurred, and that he had pulled her hair, screamed at her, grabbed her face and hit her.
Her filing alleged a history of abuse throughout the relationship.
"The judge has reviewed the evidence that we presented," Ms Heard`s lawyer Joseph Koenig told reporters outside court.
"He issued a restraining order based on the evidence that he received and there will be a further hearing."
Mr Depp`s lawyer wrote in a court filing that the actor would agree to a mutual-stay order. He is currently in Portugal with his band Hollywood Vampires.
Mr Depp, 52, and Ms Heard, 30, met while co-starring in the 2011 film The Rum Diary. They have no children.
More about: