Wire soil moisture sensor such that it only powered when measuring
OK you are hoping the transistor will behave like a relay contact but this won't happen but there is a solution (later). 

But firstly, why your current circuit won't work. 

To turn the transistor on into saturation (low volt drop between collector and emitter) you need to drive several mA of current into the base. Given that the base is a forward biased diode (internally) you have to overcome that forward bias with your GPIO voltage. Given that your GPIO voltage might be (at best) 5V then the emitter CANNOT rise to 5V or the base-emitter isn't taking current. 

This is why this type of circuit is called an emitter follower - because the emitter has to "follow" what the base does and generally lags behind by 0.7 volts.

This means you won't see more than maybe 4 to 4.5 volts on the emitter. If this is enough to power your sensor then that's fine. 

A better circuit uses a PNP transistor and an NPN transistor like this: -



It'll work at 5V of course and if your GPIO voltage is 3V3 then you'll definitely need the NPN transistor. If your GPIO voltage is 5V then, if the load is only a few mA then you can use your GPIO to the base of the PNP via (say) a 1k resistor.

If your load requires say 100 mA then it's probably better to go for a P channel mosfet: -



You have to be careful about selection of ther mosfet - it has to be able to turn on adequately from your logic signal - you need a "logic-level" p channel mosfet.