Depends on the situation.
Most of the time, you really want to avoid doing this whenever possible. It isn't impossible, but, you are unlikely to cause damage to any piece of hardware - however, any active file writes going on will instantly be cut off. If you were saving a document it will most likely be corrupt/half written and if you are performing an update, dependent on the actual process, it is highly possible to corrupt the program being updated.
However, in the situation where your computer is actually completely frozen, quite frankly, the same situation will apply where files can be corrupt at the time of the freeze. Shutting down will not cause any "extra" damage.
Turning it off from the wall, the Power unit or the button will do the exact same thing.
If you want to know the history behind this, it is a bit hard to prove definitively, but, the whole idea about this came from hard drives. Hard drives now automatically (usually) park heads when power to them is cut. In "olden" days, they didn't do this automatically and you would use the park.exe
command (came with some disks).
And if you go back further to the huge disks that were the size of desks and only had about 5MB storage, if power were to cut unsafely, the rotating diskshead would literally "crash" in to each otherthe platter.... I believe that this is where the term "crashed" came from when referring to computers... well, this is what I heard at least!
(Edit thanks to Keith Thompson - I remembered about crashing incorrectly!)