Photos and VideosMore Photos and Videos
The order Tuesday came after doctors evaluated O'Ryan, who had traveled from Florida to Los Angeles to try to meet the gymnast.
During trial, a prosecutor described O'Ryan as harboring a dangerous obsession involving Johnson.
After his arrest, police found two loaded guns, a knife and love notes addressed to Johnson in his car.
Johnson faced her stalker in court, testifying that she was scared of him, though the two had never met.