First of all the narrator chain of this hadith has a high grade of trustworthiness, as you can check here. Therefore we must assume this hadith being sahih (and not only because it is in a book called sahih).
Note that Imam Muslim quoted other narrator chains of this hadith.
Maybe the points which are difficult to understand are:
- Why our Prophet () instead of following the will of this person and freeing the 6 slaves only freed two of them?
- And why did the Prophet () speak severely about that man?
One issue is that a testament الوصية can only include one third of his property at most (Evidences from sunnah on the authority of Sa'ad ibn Malik,ibn 'Abbas, 'Aisha whom heard the conversation with Sa'ad)! And a testament can only be made for somebody who doesn't inherit by default (read for example here). Also read (2:180-182) were correcting the testament is clearly allowed, in case of it was unjust or sinful, and also read (5:106-108) on this topic!
- Imam an-Nawawi in his commentary on sahih Muslim gave an explanation:
The man made or declared this (last) will in his last days alive, he was in what is called the final illness مرض الموت. So maybe he forgot the ruling of the third or he wasn't certifiably sane. Note that scholars have some different opinions on testaments and legal actions of people in their final illness according to their mental capacity etc. (for details read this fatwa in Arabic).
So according an-Nawawi in this case the Prophet () has cast lots to choose the slaves which were set free! This is considered as legal by the majority of scholars such as Malik, a-Shafi'i, Ahmad. Ishaq, Sawod ibn Jarir and they are also in consensus that if somebody freed slaves in his final illness or declared this will and they were not more than one-third of his "property" of slaves a casting lots between them is allowed. Abu Hanifa considers casting lots as invalid, but this opinion is in clear opposite to this hadith.
So basically the Prophet () here corrected an invalid or wrong testament.
- Now to why the Prophet () said severe things: He did so because what this man has done was wrong and illegal according shari'a and in one narration (version of the hadith) these severe words were:
لو علمنا ما صلينا عليه
If we knew (what he has done) we wouldn't pray over him.
This means the Prophet () wouldn't pray the janazah himself over this man as it was quoted in ahadith about people who died in debt (see for example here) or for people who have stolen spoils (see for example here).
Note that the prayers of dua's of the Prophet were a big reassurance for his shabah:
But among the bedouins are some who believe in Allah and the Last Day and consider what they spend as means of nearness to Allah and of [obtaining] invocations of the Messenger. Unquestionably, it is a means of nearness for them. Allah will admit them to His mercy. Indeed, Allah is Forgiving and Merciful. (9:99)
Take, [O, Muhammad], from their wealth a charity by which you purify them and cause them increase, and invoke [ Allah 's blessings] upon them. Indeed, your invocations are reassurance for them. And Allah is Hearing and Knowing. (9:103)
Therefore the fact that the Prophet said he wouldn't have prayed over this men is considered a severe speech!
Conclusion:
In case this sahabi had freed his slaves before his death he wouldn't have been reproached by the Prophet (). So here the reproach and rectification are just to show us and explain that this action -however it was made with a good intention and was seemingly a good deed- was wrong and shouldn't be performed this way as this was against the shari'a!