If you are not using something like 'Caffiene', or some other 3rd-party tool to keep the MBP (Macbook Pro) actively running while it is closed, your MBP should enter stand-by within a minute or so, when the lid is closed to put into your backpack.
If the MBP is in 'stand-by', the HDD will not be spinning and is therefore very safe to transport. However, some software may, intentionally or unintentionally, keep your MBP from entering stand-by mode. If that happens, though, all hope is still not lost.
Looking at the specs for a typical 2.5", internal HDD these days yields the following:
Environmental (operating) Shock (half-sine wave) 400 G/2ms, 225 G/1ms
Environmental (non-operating) Shock (half-sine wave) 1000 G/1ms
The first thing to notice is that the limit is lower for a shorter impulse. This suggests that the drive is more sensitive to a sharp physical shock of short duration than to mild acceleration (typically < 1 G) as may be experienced on your daily commute.
If your backpack provides any padding, and you are careful to place your backpack on your floor, where it can't slide off the seat and hit the floor, it should be fine even if it is still running. But, if you are walking out and smack your backpack into a wall or doorframe on your way, the risk is much higher.
Even at the higher risk, though, the real risk is pretty low. Imagine the impact necessary to damage the drive while it is off. The shock it would take to damage it while running is still greater than 20% of the non-operating shock tolerance. That is a pretty significant shock.
For the record, I never power-off my MBP, but it DOES go into stand-by before I bag it.
I hope this helps!