Obama spent time with the family of Alton Sterling -- a black man fatally shot by a police officer in the city on July 5 -- and the families of three law officers who were killed and three officers who were injured in an ambush there 12 days later.
The meetings were not open to the media and no information was released.
Obama was in Baton Rouge to tour the flood-ravaged area. Thirteen people died and more than 60,000 homes have been damaged in flooding that started nearly two weeks ago.
But the trip also gives him a chance to touch on shootings that roiled the nation last month.
On July 5, police say, a police officer shot and killed Sterling
, an African-American resident of Baton Rouge, outside a convenience store in the city. Two police officers had confronted Sterling after someone called 911 to say that Sterling, who was selling CDs outside the store, had brandished a gun, police said.
Police said one officer shot Sterling after Sterling allegedly tried to reach a gun from his pocket. The shooting is under investigation.
Sterling's death -- and a July 6 fatal shooting of a black man by police in Minnesota -- spurred protests across the country. During one such protest on the night of July 7, a gunman shot and killed five police officers in Dallas, saying he was upset with the other shootings, police said.
On July 17, violence returned to Baton Rogue, where police say Missouri resident Gavin Long shot six law officers. Three -- Baton Rouge police Officers Montrell Jackson and Matthew Gerald and East Baton Rouge sheriff's Deputy Brad Garafola -- were killed.
A SWAT officer subsequently shot and killed Long, police say.
Long apparently visited Dallas after the shootings there, posting a YouTube video July 10 in which he spoke of the protests, and a notion that victims of bullying need to resort to brute force.
One of the officers injured in the Baton Rouge attack, East Baton Rouge Parish sheriff's Deputy Nick Tullier, was on life support into August. Earlier this month, Tullier's father, James Tullier, posted to Facebook a touching story about the deputy having helped a stranded motorist and her children
the day before he was shot.