It is a common knowledge that animals pee or poop (excrete) when they are frightened to death. People do, too. Also, animals do it right before their death. That's where the expression came from.
If you scare the s*** out of someone, it figuratively means you scare someone to the extent that they would urinate or defecate. It is a very common expression.
Note: Some do use scare the pee/urine out of someone. It has the same meaning, but less idiomatic and popular.
Sentences such as "I extremely scared her" or "I scared her very much" would not work very well because there is a more common and idiomatic expression.
The expression evolved to become an intensifier for a verb.
"Let's bomb its oil field" doesn't sound intense enough, however, "Let's bomb the s*** out of its oil field" sounds very intense. You just metaphorically compare "its oil field" to an animal or human.
As explained in the other answer, the list of expressions goes on and on. The most important thing to remember is:
Whatever expletive is put in X in Verb X out of Y constructions, it is a strong
intensifier. It gets the message across in a strong/intense sense.
I will stop writing on this now before some members "criticize the s*** out of me".
Note: You can use it for a verb like criticize, which means you can be creative in using it.
Edit:
As commented below, the above expression can be toned down a little by saying, "Bomb the hell out of its oil field". It's slightly more acceptable than "bomb the s*** out of its oil field".