The US president appeared to make an ill-timed compliment about his Turkish counterpart during a meeting with Americans jailed abroad.