The first is to be called upon to serve as a witness and to retain the testimony entrusted to him.
The second is to be called upon to testify to what he knows, whether or not he was entrusted with retaining it.
Section
As for the first category—being called upon to serve as a witness and to retain testimony—this is a collective obligation, discharged by some on behalf of others, like jihad, the funeral prayer, and similar duties. If a man is somewhere where no one else can discharge this duty on his behalf, it becomes an individual obligation upon him. The evidence for this is that Allah, Exalted is He, has commanded the fulfilment of testimony, saying:
“And establish testimony for Allah.” [Al-Talāq: 2]
Once this duty has been discharged, the command has been obeyed and the obligation fulfilled, since there is no purpose in others undertaking it thereafter.
As for the second category—being called upon to testify to what one knows and has been entrusted with retaining—this is obligatory upon him, because Allah, Exalted is He, says:
“Let witnesses not refuse when they are called upon.” [Al-Baqarah: 282]
And:
“Do not conceal testimony. Whoever conceals it has a sinful heart.” [Al-Baqarah: 283]
And:
“And establish testimony for Allah.” [Al-Talāq: 2]
Section
Anyone who has testimony to give may not conceal it and must give it when called upon. As for someone who has not been called upon to testify, the Messenger of Allah ﷺ said:
“The best witness is the one who gives his testimony before being asked for it—or discloses his testimony before being asked for it.”
This is divided