Martin, who graduated from the school in 2008, was detained by police last week after posting a photo on his Instagram of a shotgun and ammunition.
The order prohibits him from entering the campus and requires him to stay 150 yards away from school properties and facilities. He must also stay 150 yards away from Rick Commons, the president and head of the school.
The former Miami Dolphins offensive lineman tagged the school and two names of former Harvard-Westlake classmates.
The photo on his private but verified Instagram account had the caption "When you're a bully victim & a coward, your options are suicide or revenge".
The barrel of the shotgun had "#HarvardWestlake" written on it, while "#MiamiDolphins" was written on the stock.
The post also tagged accounts belonging to former Dolphins teammates Richie Incognito and Mike Pouncey, according to ESPN.
Out of precaution, the campus was shut down when Martin posted the photo.
Police were investigating if Martin created the post or if it was the work of hackers.
Martin made headlines in 2012 when he accused Incognito and Pouncey of severe bullying, resulting in Incognito being suspended for half the 2013 season.
Martin has since checked into a mental health facility. His hearing will be held March 22.