It's part of a process called discovery. All parties are supposed to be interested in justice. Before trial the opposing sides are required to turn over all relevant info. Relevant means at least one party thinks it is. That way the withholding of evidence should not occur. For the particulars, the rules of the jurisdiction you're interested in should be looked at.