This is due to all the pins going high for the duration of the power up reset period, this will also happen with a soft reset. This a is a very common problem. There are a couple of solutions, one is to use an RC delay on the base of the driver transistor. A better way is to use inverted or active low logic, you will need a couple of transistors and a few resistors, or you can use part of a ULN2003A darlington driver as follows.
Pin 8 to ground
Pin 9 to 24v
Connect 10K resistor from pin 1 to 5V
Connect 10K resistor from pin 16 to 24V
Connect pin 2 to pin 16
Input from MCU is to pin 1
Output to relay is pin 15, other side of relay to 24v
A logic 0 will then switch on the relay, a logic 1 will switch it off.
There are enough drivers in the chip to operate another two relays using this method, or you could use a ULN2803A to drive 4 relays etc from 4 inputs. You may not need the 10k to 5v unless you are using open drain outputs, probably good practice to include it though. All you are doing with this method is using the first darlington as an invertor to drive the next darlington. Hope this helps in some way.