"You gotta put this guy in the Senate," Obama told a crowd of about 300, before clasping hands with Cardin. "Put on your marching shoes — we're going to get out and march for Ben Cardin."
The 10-term Cardin also was joined for the first time by the black Democrat he narrowly beat two weeks ago for the nomination, former NAACP head Kweisi Mfume.
"We are united as Democrats," Cardin told the crowd at the University of Maryland.
The event was an early shot at winning black support in a Senate contest in which race looms large. After Mfume's defeat, some black Democratic voters said they'd switch their support from Mfume to Republican Lt. Gov. Michael Steele, the only black candidate ever elected statewide in Maryland. The state's population is 29 percent black.
Cardin's appearance with Obama and Mfume — in Steele's majority-black home county of Prince George's — was intended to send a message that black voters support Cardin.
Mfume, who lost to Cardin by less than 20,000 votes, acknowledged the primary election race was tight but emphasized that he supported Cardin.
"Ben Cardin will tell you I'd be a great senator," Mfume deadpanned. "But Ben is the nominee. And the nominee I support."
Republicans aren't ceding the black vote to Cardin and the Democrats. At a Republican dinner Tuesday in Baltimore, party leaders told about 1,000 donors that their statewide ticket — which includes Steele and a blind woman running for lieutenant governor — is more diverse than that of the Democrats.
"The Democrats often talk about diversity and inclusion, but I've got to say, talk to the hand," said Kristen Cox, the lieutenant governor nominee.
Steele told the crowd he'd win, even though Democrats outnumber Republicans 2-to-1 in Maryland.
"This November, the people of Maryland will stand with us," he said. "They'll send a little brother from Prince George's County to Washington to shake things up."