The orientation of hard drive was historically considered important.
Seeing that some versions of iPod's have the drive turned around all the time, one would think drive orientation change wouldn't matter.
However from personal experience with desktop drives, the "field" knowledge from multiple PC repair techs I have known over the years, as well as that expressed by other comments in various forums, I've personally taken a cautious view that changing orientation during use could be a real problem.
Specifically the common theme I've heard and experienced is that if you originally formatted the drive when it was horizontal, then using it vertically may make it more prone to read/write errors. Similarly if you originally formatted it while vertical, then it would be problematic when used horizontally. I have used that tidbit of info as an additional precaution while recovering an old drive that started clicking. However in laptop drives it may not be applicable since manufacturers expect the drive to be moved around a lot more than desktop drives. YMMV.
Your laptop drive was likely originally formatted when horizontal, so positioning vertically, especially while running builds because of large amount of reads and writes could be a problem, if the above holds for laptop drives.
Hard drive reader heads aren't exactly an equal length lever on both sides of the fulcrum (pivot). One side of the head is long and thin while the other side is short and heavy, crudely shown below:
See a more accurate view of the geometry of the drives, here. This might be interesting as well, knowing that the core drive mechanical structure hasn't really changed in multiple decades.
The design is engineered to have the same weight on both sides of the lever to minimize mechanical energy expended in starting and stopping the motion.
Two things happen here..
When rotating the head on another axis besides it's own pivot axis, the head is subject to gyro forces and as a result subject to mechanical stress during motion.
When pivot is vertical (i.e. head motion plane is horizontal) then the pivot has no stress moving it sideways. However when the pivot is horizontal (i.e. the head motion plane is vertical or the drive is vertical) then due to the weight of the head mechanism, the pivot will (due to its weight) put pressure on the bearings it is positioned on due to gravitational pull. No matter how precise the engineering, there will be some measurable effect on the bearings that will only come into play in vertical drives. This I guess, will be enough to cause the head to read the disk surface slightly offset.
Item #1 (gyro effect) could be a significant issue on multiple axes especially when the laptop is in a backpack and moving/bouncing up and down and rocking back and forth on the owner's back as the owner is walking. Though human motion is way slower compared to drive platters or readers' motion, so it may not be as significant as might be expected.
Item #2 could be an issue as well albeit less significant and much more automatically corrected with normal calibration that the modern drives already do.
In either case don't move your spinning drive like a pompom
Regarding heat build up: Others have mentioned the heat accumulation inside the bag. I want to reiterate from personal experience that this can be a HUGE issue, and I'd really advise that you avoid putting a working laptop inside a bag for any longer than 1-2 minutes. Be careful with the sleep button, too. Sleep can fail if an error dialog pops up and you don't realize it. If that happens, your laptop can overheat, CPU protection may kick in, and you could lose your work, or worse.
If you really have to keep your laptop in the bag, see if you're able to get a vertical airpath with at least one air entry in the bag near the bottom and at least one air exit near the top. And make sure your laptop has vents that align with the bag's air entry points, only then will it be safe to leave your laptop in there for any longer than 5 minutes.
Does vertical position affect the lifespan or integrity of a hard drive?