TOKYO — The United States military imposed a curfew on Friday on all of its nearly 50,000 uniformed personnel stationed in Japan, as it tried to respond to public outrage over reports of the rape of a woman on Okinawa by two American sailors.

The commander of United States forces in Japan, Lt. Gen. Salvatore A. Angelella, apologized for the case, saying that American military personnel will also be required to take “core values training.” Earlier Friday, the United States ambassador to Japan, John V. Roos, told the Japanese defense minister and the governor of Okinawa that the United States would cooperate “in every way possible” with the investigation of the two sailors, who are in Japanese custody.

General Angelella told a news conference at the United States Embassy in Tokyo, “I want to personally apologize for the grief and trauma the victim has endured and the anger it has caused among people on Okinawa.” He said the curfew, from 11 p.m. to 5 a.m., would take effect immediately at bases in Okinawa and the rest of Japan.

The Japanese police say the two sailors in the latest case had been out drinking when they attacked the woman, who is in her 20s, as she walked home before dawn on Tuesday. The sailors, Seaman Christopher Browning and Petty Officer Third Class Skyler Dozierwalker, were arrested soon after by Japanese police officers. The Navy has also begun its own investigation.