The US president says he and his wife are praying for the victims of a racially motivated shooting.