It is the law that lets a journalist protect a confidential source, even from a court. Without it, the promise reporters make to whistleblowers, that they will not be named, could not be kept.
A shield law protects journalists from being forced to reveal their confidential sources or unpublished material, even under a court subpoena. It shields the relationship between a reporter and a source who speaks only on the promise of anonymity.
It exists because so much important news depends on confidentiality. Whistleblowers, insiders, and the frightened often will only talk to a reporter if they are sure their identity will be protected. If a journalist can be compelled to name them, that flow of information dries up.
The protection is patchy. Most states have shield laws or court rules protecting reporters, but they vary widely, and there is no general federal shield law, which has at times led to reporters being jailed for refusing to name a source.
It reflects a hard balance. Courts have a strong interest in everyone's evidence, but a free press has a strong interest in keeping its promises to sources. Shield laws are society's attempt to weigh the public's need for a robust press against the legal system's hunger for testimony.