In mid-1940, by-then-Captain Davis became the aviation officer on the staff of the Commander-in-Chief, Pacific Fleet, the position he held when the Japanese attacked Pearl Harbor, Hawaii, on 7 December 1941. This incident brought the United States into World War II. He continued in this position until 30 June 1942. For his next tour, he was named as the commanding officer of the aircraft carrier. However, the ship was sunk on 7 June 1942 in the late stages of the Battle of Midway before he could report aboard. As a result, he instead took command of the aircraft carrier on 30 June 1942. Davis led Enterprise into combat in the Guadalcanal campaign, supported United States Marine Corps amphibious landings on Guadalcanal in the Solomon Islands and fought in the Battle of the Eastern Solomons on 24 August 1942. During the battle, USS Enterprise suffered more damage than any other American ship involved, when Japanese dive bombers scored three hits and four near misses on her, killing 77 and wounding 91 of her crew and seriously damaging her. After his promotion to rear admiral, Davis received the Navy Cross for his actions aboard USS Enterprise on 24 August, the citation for the award read, "By his remarkable seamanship, resourcefulness and his outstanding skill in maneuvering his ship, Rear Admiral Davis met the vigorous Japanese dive-bombing attack coolly and courageously, holding the damage by bomb hits to the Enterprise to a minimum and, in turn, inflicting heavy casualties on the attacking enemy planes." After relinquishing command of USS Enterprise on 21 October 1942 and receiving his promotion to rear admiral, Davis served in the Atlantic Fleet, first as Commander, Carrier Replacement Squadron, Atlantic Fleet in 1942, then as Commander, Fleet Air, Atlantic Fleet, from 1942 to 1943, and finally as Assistant Chief of Staff, Atlantic Fleet, from 1943 to 1944. In September 1944, Admiral Raymond A. Spruance, the Commander of United States Fifth Fleet, reluctantly chose Davis as his chief of staff after Admiral Ernest King, the Chief of Naval Operations, ordered that all commanders with a surface warfare background have a chief of staff with aviation experience and vice versa. Davis won over Spruance with his competence and congeniality and was described as a "lean, rough, aggressive leader" who "moved decisively and intelligently." Davis was with the Fifth Fleet until July 1945, and during his tour the fleet operated in the Pacific Ocean against Japanese forces in the Iwo Jima and Okinawa campaigns. He then became the commander of Carrier Division Five.
Davis received an award of the Navy Cross, two awards of the Distinguished Service Medal, and three awards of the Legion of Merit. In addition, USS Enterprise was awarded a Presidential Unit Citation for the period 7 December 1941 to 15 November 1942, which included Daviss time in command.