Barley is one of the three primary gluten-based grains. Therefore, in almost all cases, foods made with barley will contain the gluten protein, and people following a gluten-free diet will need to avoid them.
The scientific name for the gluten protein in barley is hordein. Hordein actually occurs in the seeds of the plant, which we know as the grain.
The vast majority of products that use barley as an ingredient use those grains/seeds, not any other part of the plant. Therefore, almost everything made with barley contains gluten. This includes most beers (made with fermented barley), malted milk, malted candy and other malted products (malt is made from barley grains that are germinated and then dried), barley flour (used sometimes in baking) and barley pearls (frequently found in soups).
There's some controversy over whether barley grass (the immature stalks of the plant) contains gluten, and some vitamin products carry a gluten-free label despite the fact that they include barley grass. However, most experts advise using extreme caution when considering whether to consume these products. You can read more here: Are Wheat Grass and Barley Grass Gluten-Free?
Barley frequently is used as a sweetener in processed foods cereals such as corn flakes are a good example of this practice. In addition, numerous candy bars especially crispy rice varieties contain barley malt. (This article lists safe and unsafe candies: Gluten-Free Candy.)
Unfortunately, food labeling laws do not require manufacturers to disclose barley or barley-based ingredients such as malt. Therefore, it's possible for manufacturers to "hide" those gluten-containing ingredients under catch-all terms such as "natural flavorings."
Some manufacturers voluntarily disclose barley ingredients by listing them as "natural flavorings (barley malt)" on their labels. My article How To Identify Gluten on Food Labels explains which companies follow this practice, and provides tips on avoiding barley along with wheat and rye in processed food products.
And if you're looking for beer made without barley that you can enjoy on the gluten-free diet, there actually are plenty of decent options out there: Gluten-Free Beer.