No, your front driveshaft will not spin freely in 2WD. Your front axle and driveshaftare always locked and spinning when your vehicle is moving. When you engage the 4wd in the transfer case it then gets power transfer along with the rear wheels.
The connection is inside the transfer case not the front differential.
So the front wheels, the front axles, the differential, and and drive shaft turn all the time. When you engage the vehicle into 4-wheel drive the connection is made inside the transfer case. At that point, the front is actually driving along with the rear.
Older 4-wheel drive vehicles (and some modern 4-wheel drive vehicles) have locking hubs where you can either electronically or manually disengage the hubs so that only the wheels turn and not the rest of the front drivetrain.