Revd Clementa Pinckney was one of nine people shot dead at the black Emanuel AME church in Charleston, South Carolina last week.
Speaking immediately after the shooting, the President confirmed he and his wife, First Lady Michelle, were friends with the pastor and his family.
"Michelle and I know several members of Emanuel AME Church. We knew their pastor, Revd Clementa Pinckney, who, along with eight others, gathered in prayer and fellowship and was murdered last night," he said.
He added: "To say our thoughts and prayers are with them and their families, and their community doesn't say enough to convey the heartache and the sadness and the anger that we feel."
Mr Obama will travel to the city on Friday for the funeral service of Revd Pinckney, who he met during the 2008 presidential campaign.
The other victims of the attack were Cynthia Hurd, 54, Revd Sharonda Coleman-Singleton, 45, Tywanza Sanders, 26, Ethel Lance, 70, Revd Depayne Middleton-Doctor, 49, Susie Jackson, 87, Revd Daniel Simmons Sr, 74 and Myra Thompson, 59.
A man, 21-year-old Dylann Roof, has been charged with nine counts of murder and officers say the shooting was a hate crime.
The White House said it would not release any other details of the President's trip.