The Taliban government said it had released two American citizens from prison in return for an Afghan fighter held in the United States, in a deal brokered by Qatar.