Datasheet!

By default your PIC will come up in Analog Input mode on PortA.

When you initialise your PIC your first instructions should be...

TRISA=%xxxxxx0x

where x defines your other pins I/O status...

ADCON1=%00000111

to switch into Digital Mode, and finally...

Low PORTA.1

Now Bruce would prefer you to put the 'Low PORTA.1' first which could be good, but I calculate at 4Mhz, that's 3uS from the moment your PIC powers up, to that pin going low anyhow (and there's no-way your solenoid can react that fast). If you want to include a "belt and braces" solution, then put a 100nF Capacitor (of the type you use to decouple your PIC) between PortA.1 and Vss. That Cap will try to nail any initial spike during the first switch-on period before the PIC actually takes that pin low.

Remember, these MUST be the FIRST instructions your PIC executes.

Of course, depending on your PSU, if it's pretty crappy it could be a while (several mS) before your PIC wakes up. In that case you might need a more sophisticated input circuit to your FET than a single Resistor between the PIC and the FET gate. But that's another story...