Can I varnish natural wood trim before installation?
The main issue would be with covering any nail/screw holes after you've fixed it to the wall. Other than that I can't see a problem with varnishing before hand.

As each coat of varnish darkens the wood you could end up with a darker patch over each nail. However, using the same approach as usual - leaving the last coat until after installation will reduce this.

Another alternative would be to glue the trim in place - that way there's no nail holes to fill.