If an object would be too tough to puncture while static, is it possible to pierce it while holding still and having it move toward you?

There are three ways ways this might work, all of which using Shelob's own strength.

  1. First, as noted in other answers, the sword could have been driven down until the hilt struck the floor and was braced that way.
  2. The sword could have been held straight up with the arms and legs locked and the crosspiece of the sword pressed against the hands. In this stance, a body could withstand more force than the muscles could actively exert, and thus act as sufficient brace against Shelob's own superior strength.
  3. The text seems to support that Shelob's body was hard. Piercing thus is a matter not of force, per se, but of impulse: mv = Ft. The harder the shell, likely the more a quick impulse will break it. Shelob could have moved with such speed against a thrust that the impulse time was shortened, and the strength of Sam's own thrust multiplied because of the shortened interval, since that equation rearranges to F = mv/t.

A combination of 2 and 3 are also possible. As any good martial artist knows, you can deliver more power by timing your blows so that your joints are locking just as contact is made. This multiplies the speed and strength of, say, a punch with the power and weight of the body following through behind the punch. You can multiply the force of a punch by putting your whole torso into it and achieve more power than you can muster using your arm alone. Shelob throwing her own strength against Sam just as an upward thrust was reaching home and his arms locking combines the added impulse from the speed of contact with the force resistance of Sam's locked joints. It is perfectly reasonable to assume that this may have ultimately driven Sam down, but still have pierced her.

See edit at bottom as well

It is a bit unclear from the text whether the description is contradictory/physical or not.

Here is the text:

But Shelob was not as dragons are, no softer spot had she save only her eyes. Knobbed and pitted with corruption was her age-old hide, but ever thickened from within with layer on layer of evil growth. The blade scored it with a dreadful gash, but those hideous folds could not be pierced by any strength of men, not though Elf or Dwarf should forge the steel or the hand of Beren or of Túrin wield it. She yielded to the stroke, and then heaved up the great bag of her belly high above Sam's head. Poison frothed and bubbled from the wound. Now splaying her legs she drove her huge bulk down on him again. Too soon. For Sam still stood upon his feet, and dropping his own sword, with both hands he held the elven-blade point upwards, fending off that ghastly roof; and so Shelob, with the driving force of her own cruel will, with strength greater than any warrior's hand, thrust herself upon a bitter spike. Deep, deep it pricked, as Sam was crushed slowly to the ground.

Assume there must be some threshold force, $F_{pierce}$ for the blade to pierce Shelob's skin. Suppose the blade was stuck in the ground hilt down, blade up. As Shelob lowers her body weight onto the sword she would put a force onto the sword and the sword would put a force onto her (Newton's third law). However, Since the sword is stuck in the ground the ground will ALSO put a normal force onto the sword. This normal force could balance the force from Shelob such that the blade stays stationary. If Shelob keeps putting her weight down it must pierce her skin.

It is clear that for the sword to stay stationary the normal force must equal to the force which Shelob puts on the blade. If this force exceeds the piercing threshold force, $F_{pierce}$ then it is seen that the normal force must also exceed $F_{pierce}$.

Note that whether a blade pierces an object depends on the pressure supplied rather than the force. Pressure is force divided by area, $P = \frac{F}{A}$. Sharper blades have smaller tip areas so the same force provides higher power. That is, $F_{pierce}$ is a blade dependent quantity. We will use $F_{pierce}$ relevant for Sting, the blade Sam was wielding at the time. Nonetheless, author Tolkien indicates that no one can supply sufficient force to pierce the skin regardless of the blade used.

This is the physics of the problem. Unfortunately it is not clear how this physics applies to Tolkiens description of the action. Initially Sam is standing up point the blade upwards. Shelob puts her weight down onto the blade. If we are being consistent I think we have to assume that Sam can not supply $F_{pierce}$. This means that his own body must start falling under the weight of Shelob without piercing her. Of course, this is consistent with Tolkien's text: "Deep, deep it pricked, as Sam was crushed slowly to the ground".

It is unclear when the piercing actually happened.. I think the best hope we have for consistency is what is described in Andrew Steane's answer. If the sword become lodged at all in Shelob due to Sams holding it upwards and then the hilt actually hits the ground then it is possible that the normal force of the ground, matching Shelob's weight, could supply the requisite piercing force to pierce into Shelob.

Tolkien was not a physicist, but I think from the statement about Sam's being crushed to the ground we can conclude that Tolkien understood that there would be enormous forces on Sam during this sequence of events as well. It is not clear if he made some misunderstanding and in his minds eye saw the blade piercing Shelob before Sam fell entirely to the ground or not. If this is what we are to imagine then I would say it is inconsistent with his claim that "those hideous folds could not be pierced by any strength of men" if we assume that Sam has less strength than a man.

We might nitpick that the quoted paragraph makes no statements about if hobbits have enough strength to pierce Shelob. This sort of reasoning has some precedent in the fact that Eowyn could kill the Witch King of Angmar (who was predicted to not be able to be killed by any man) because she was in fact a woman. However, I think that was more a case of "something something prophecy/magic" whereas in this case Tolkien's claim is that men literally don't have enough strength to provide the necessary force. I think it would be ridiculous to suppose that the way around the contradiction here is that in that moment Sam showed more strength than any man could.

It is not clear if we are supposed to envision the sword butting against the ground scenario or not though I'll admit that to my physics brain I think this visualization did cross my mind.

Summary: It's not entirely clear from the text whether there is a contradiction or not. It seems like Tolkien was maybe thinking about it a little but maybe not with the full rigor of Netwon's third law.. A little more description probably could have saved this contradiction at not too much literary cost but oh well. It was a heated moment and everything was happening very fast! Maybe it was just some complicated mix of events that would have been a pain to describe in intro-physics homework problem sufficient detail.

Of course.. that gives me a good idea for an intro-physics homework problem...

edit: @Joshua makes a very good point in the comments. With the appropriate stance one can resist much more force than they could hope to deliver using their own muscles. This is because the person can bear the load on their skeleton rather than relying on contraction of their muscles to supply the force. Perhaps Tolkien's comments about the hideous folds not being pierced by strength of men refers to a man or woman jabbing or slashing directly at the skin of Shelob while Sam's tactic of standing under Shelob's falling body skirts around the limitation presented by Tolkien.

I always pictured it as Sam underneath Shelob with sword pointing up; Shelob slams her body down onto him, sword ends up vertical between the rocky ground and Shelob's body, so it is her weight which provides the force. Sam meanwhile presumably rolls to one side. Or perhaps he can survive getting momentarily pinned to the ground as I suppose the hilt does not enter and Shelob's body maybe flexes a bit. So the physics would require merely that the material of the sword can withstand the applied force without bending, and that the point of the sword is hard and sharp enough to do its thing. Also the ground would need to be hard. Is this physics? Sure! Why not? But enchantment of blades is not physics ... unless it is a name for a pattern welding or something like that.