When something is said to cost an arm and a leg, it is extremely expensive. The subtext of this idiom is that the price may be exorbitant, as losing an arm and a leg would be a high price indeed. One might say, for example “coffee from that place down the street costs an arm and a leg,” meaning that it's expensive and probably too costly for what it is. This term is most classically used in complaints of some form or another.
While many English speakers use this idiom, its origins are a bit unclear. A number of fascinating explanations have been bandied about, but none of them are verifiable. We're not even sure when the term entered the English language, although it appears to date to the 1930s or 1940s, and it seems to have been traced to the United States. However, neither of these things has been proved, so the term might be even older, or of non-American origin.
The most far-fetched explanation suggests that it is a reference to the cost of painted portraits. Allegedly, painters charged extra for portraits which included the limbs, using this limb-by-limb billing technique to inflate their prices. However, research has not supported this explanation. Portrait painters did not charge by the limb, and if they had, one would think that documented instances of “an arm and a leg” in reference to high prices dating to the 17th or 19th centuries could be found.
This term may also have military origins. Many soldiers lost limbs in the First World War, and they became very public figures in their communities at home when they returned. The loss of an arm or leg would have been devastating, but losing both would have made someone's life extremely difficult. However, turning a tragedy into a popular idiom seems a bit unlikely. A more likely military explanation involves being demoted, a process in which someone would lose the stripes used to denote military rank. Undertaking a risky endeavor could result in demotion and the loss of an “arm,” in the sense of the loss of the distinctive stripes, a high price to pay both in terms of esteem and salary.
Others have suggested that it may have originated in the criminal underworld, where people supposedly said “even if it costs a leg” to describe an act of extreme desperation. This is not an entirely unreasonable explanation for the phrase origins of this term, especially since lots of things were dangerous to the extremities around the 1920s and 1930s, ranging from trains to factory equipment. Working in the underworld would definitely lead people to risk an arm and a leg now and then to get ahead.