 In 1882, O'Hara was elected to Congress from North Carolina's 2nd congressional district.He served in the Forty-eighth Congress and was re-elected to the Forty-ninth Congress, serving from March 4, 1883 - March 3, 1887.He was the second African American (after John A. Hyman) to be elected to Congress from North Carolina and was the first to be elected following the end of the Reconstruction era.