Shaykh Maulana Abdul Aziz Alvi
Hadith Commentary: Benefits and Issues:
This hadith establishes that agreements and covenants made with disbelievers should be fulfilled, and disbelievers should not be given the opportunity to accuse Muslims of breaking their promises.
Even though adhering to such a covenant is not obligatory, because waging jihad against disbelievers together with the Imam is a religious duty,
therefore, the view of Imam Abu Hanifah and Imam Shafi'i is that if a Muslim prisoner makes a covenant with the disbelievers,
such as promising not to escape, then it is not obligatory for him to adhere to this covenant.
If he gets an opportunity to escape, he may do so.
However, according to Imam Malik, the apparent meaning of the hadith is that fulfilling the covenant is obligatory.
Yes, if they force him to swear an oath that he will not escape, then due to compulsion, such an oath is not considered valid.
Source: Tuhfat al-Muslim: Commentary on Sahih Muslim, Page: 4639