Intro
If an old galvanized pipe comes out from the wall, installing a shutoff valve is usually a straightforward job; simply screw a threaded stop valve onto the pipe.
If possible unscrew the supply tube at the bottom only, so it remains attached to the faucet or toilet above. If this is not possible, you may have to cut through the supply tube with a hacksaw and replace the tube after installing the valve.
Unscrew the parts up to the nipple that sticks out of the wall. Look into the pipe with a flashlight. If it is partially filled with mineral deposits, replacing it will increase the faucet's (or toilet's) water pressure.
Some water will remain in the pipes and tubes after water has stopped flowing out the faucet, so you might want to place a bucket or a thick towel underneath.
Checklist
Time
One or two hours
Tools
Two pipe wrenches, adjustable wrench, possibly a hacksaw
Skills
Cutting and joining steel pipe
Prep
Shut off the water; drain the line; place a bucket or towel below the pipe to be cut to catch debris
Materials
New threaded stop valve for your size of pipe, pipe-thread tape, possibly a pipe nipple