Gastric, or stomach, acid is composed largely of hydrochloric acid, at a molarity of about 0.16M. While stomach acid is not directly responsible for most digestion that takes place in the stomach, it plays an important role in killing potentially dangerous microorganisms and beginning the breakdown of proteins.
Stomach acid receives a lot of bad press, which is encouraged by makers of antacids and other pharmaceuticals. Gastric acid is an indispensable part of the digestive process. Without sufficient levels of acid, the stomach cannot properly "soup-ify" or break down its contents, resulting in some types of malnutrition because many things then cannot be adequately absorbed through the small intestine. It also helps keep microorganisms that may have been ingested with food from getting into the small intestine, where they could kill off the microorganisms that live there and assist with digestion and nutrient uptake.
The function of stomach acid is to be, well, acidic. The extremely low pH of stomach acid is what kills microorganisms, by making the stomach an extremely inhospitable environment for them. The tendency of the ions to tear apart other molecules is also what makes gastric acid begin unfolding proteins, making pepsin's job easier. Pepsin is the enzyme that does most of the digestion of proteins, and it is actually activated by low pH -- another reason the acid content of the stomach is important.
Since stomach acid is such a strong acid, it can cause a variety of problems when it is mismanaged or otherwise gets out of control. Perhaps the most common of these is acid reflux, especially when it manifests as heartburn, which is estimated to affect about 20 percent of Americans on a weekly basis. This disease occurs when the contents of the stomach, especially more acidic bile, get through the lower esophageal sphincter, and irritates the esophagus. Another common problem are ulcers, which are caused when the acid chews through the protective mucus layer of the stomach (or beginning of the small intestine) and begins eroding the walls.
Even though there are significant amounts of hydrochloric acid in the stomach, do not be tempted to drink hydrochloric acid. The balance of acid to protective mucus lining is a careful one, and hydrochloric acid consumed in any quantity will result in a quick trip to the hospital. It is also very damaging the whole way down -- this is the same reason (in reverse) that regular vomiting, as occurs in bulimics or alcoholics, is so hard on the upper digestive tract. These regions do not have the same protections in place as the stomach.
There are a number of factors that can put an individual at increased risk for gastric acid-related disorders. These include certain activities, such as smoking, alcohol consumption (alcohol is itself acidic!), and irregular eating habits, such as skipping meals. Certain medications, such as aspirins and corticosteroids, can also cause problems, and other conditions, such as liver disease, emphysema, and rheumatoid arthritis seem to increase risk -- as does having Type O blood!