The agreement is part of President Trump’s efforts to find governments willing to accept people who have been detained in the United States.