By Jeff Mason

UPPER MARLBORO Md. (Reuters) - President Barack Obama made a rare appearance on the campaign trail on Sunday with a rally to support the Democratic candidate for governor in Maryland, but early departures of crowd members while he spoke underscored his continuing unpopularity.

With approval levels hovering around record lows, Obama has spent most of his campaign-related efforts this year raising money for struggling Democrats, who risk losing control of the U.S. Senate in the Nov. 4 midterm election.

Most candidates from his party have been wary of appearing with him during their election races because of his sagging popularity.

Not so Lieutenant Governor Anthony Brown of Maryland, who is running for governor, and Governor Pat Quinn of Illinois, who is running for re-election. Obama plans to appear at an event for Quinn later in the evening.

"You've got to vote," Obama repeated over and over at a rally for Brown in Upper Marlboro, Maryland, near Washington.

Democrats have a history of not turning up to vote in midterm elections.

"There are no excuses. The future is up to us," Obama said.

A steady stream of people walked out of the auditorium while he spoke, however, and a heckler interrupted his remarks.

Obama's help, or lack thereof, may not matter much to Brown, who is 11 points ahead of Republican opponent Larry Hogan, according to an average of polls by RealClearPolitics.

Quinn's race is tighter. He is ahead of Republican opponent Bruce Rauner by 1.8 points, according to the RealClearPolitics average.

Obama is scheduled to spend the night at his Chicago home after the campaign event for Quinn.

(Reporting by Jeff Mason; Editing by Mohammad Zargham)