Using pin12 on the WiFi shield makes it not connect to network

Could be the load on the line. Try putting a 1K pullup on pin 12 close to the Arduino.