Pete Buttigieg announced his exit from the Democratic presidential race, ending an improbable and historic rise from youthful gay mayor of an Indiana city of about 100,000 people to serious nomination contender.

Speaking in his hometown and the city he governed, Mr. Buttigieg told campaign workers and supporters in South Bend on Sunday evening that he would step aside to “help bring our party and our country together.”

He...