Just because some idiot detective said it doesn't mean it's true.
"Witness Protection" is an extreme measure and costs (literally) hundreds of thousands. It is NOT used routinely and it is certainly not something that a DC should be discussing with a witness at such an early stage. It would only
ever be something considered for an absolutely crucial witness in an extremely serious case (though a shooting may be such a case) where there was no other evidence.
What they
should have been talking about is (a) how rare any sort of repurcussions against a genuine, honest witness (as opposed to a pissed off former partner in crime or someone else known to the suspect) are; (b) how there are various measures available which can be used to protect a witness in the rare cases when that happens and (c) how important it is that people who witness serious crime stand up and support our CJS by giving evidence, otherwise the bad guys win.
If you were still unwilling to provide a statement, they would then be quite right to point out that you
could be summonsed to Court and, if you then refused to tell the Court what you had seen, you
could be dealt with for contempt of Court and that might mean imprisonment. That
is the situation in England and Wales. Though (a) it shouldn't be used or threatened until after all other persuasion has been tried and (b) it's hardly ever used and even less cases result in any proceedings for Contempt of Court (and usually only where there is some maliciousness in the silence (such as the witness wanting to say nothing to positively help the suspect)).
It is the realisation of the ineffectiveness of these means that was one of the factors behind the legislatio which allows statements to be read in cases where witnesses have been threatened into non-appearance (this only refers to formal, written witness statements, by the way, not verbal accounts given to officers (though there have been similar relaxations of the rules against heresay which make that more possible now too)).
Personally I think there should be stronger and more effective means to bring witnesses before the Courts - whilst it remains pretty much their choice, with no sanction, it is very easy for them to act on unrealistic fears or to be persuaded not to cooperate with the CJS where they know the suspect. A sanction against the witness for refusal would give them the "I didn't really want to, but they made me" option, just as is the justification in domestic abuse prosecutions without the victim's cooperation.