Any exhaust can be put on any car with enough time spent on welding, bending, etc.
The STi exhaust is not a direct fit on any Legacy. It can be made to fit, however.
You also have to account for the differences on the Legacies...what legacy? sedan or wagon? Turbo or not?