If a person makes a statement to police and 2 years later in a courtroom, under oath but not the same case, they make a statement that directly contradicts their witness statement does the defense have an obligation to inform the prosecution of that fact or can they use it in court to discredit the witness on the stand? (Assume that the contradiction will greatly benefit the defense and the witness is an important part of the prosecution's case.)
The defence in a criminal case has no obligation to inform the prosecution of anything. The onus is on the prosecution to provide the evidence to convict and the defence doesn't have to and indeed shouldn't help them do it.
The defence can and probably would use conflicting statements by a prosecution witness to discredit that witness in the eyes of the jury. These do not have to be material to the case: just showing the witness is inconsistent in general is helpful.
The defense has every right to do the best for its client. Unless it is specifically barred by either the law or by the judge, the defense can do anything and everything to protect its client. Without informing the prosecution beforehand, and without reference to the impact that it might have on anyone else (assuming it's within the law).
In the "The Defense Never Rests," F. Lee Bailey related how a lawyer friend of his asked him not to pursue a line of questioning because it would expose his client's adulterous affair. Bailey did what a good defense lawyer would do; ask the questions, win the case, and lose a friend.