Marble is made from an ionic compound called calcium carbonate with the chemical formula CaCO3. This compound consists of the carbonate ion, CO3, which has a negative charge of -2, and the calcium ion, which has a positive charge of +2. These opposite charges are attracted to each other, and this force holds the ions together in a crystal lattice. They can, however, react with hydrochloric acid to yield carbon dioxide, calcium chloride and water.
Many chemical reactions are two-way, meaning that the reaction can go either in forward or reverse. The reaction will eventually reach a dynamic equilibrium, where both the forward and reverse reactions take place at the same rate. Consequently, although both forward and reverse reactions continue to take place, the concentration of products and reactants ceases to change. When a system is at equilibrium, increasing the concentration of a reactant or product will increase the rate of the forward or reverse reaction in such a way that the system returns to equilibrium. In other words, chemical reactions tend towards equilibrium. This idea is called Le Chatellier's Principle.
When carbon dioxide dissolves in water, it reacts with water molecules to yield carbonic acid, H2CO3. Carbonic acid can in turn donate protons(H+) to water to yield first bicarbonate (HCO3-) then carbonate (CO3 -2). This series of two-way reactions can be depicted as follows:
CO2 + H2O <=> H2CO3 <=> HCO3- and H+ <=> CO3 -2 and 2 H+
From Le Chatellier's Principle, we can predict that if we add H+ to the solution, the rate of the reverse reactions will increase, and the net trend will be towards first carbonic acid (H2CO3), then carbon dioxide and water (CO2 and H2O). In fact, if you take baking soda, which contains HCO3-, and add vinegar, which donates H+ to the solution, this is precisely what happens: the increased H+ increases the rate of the reverse reactions, forming carbon dioxide and water.
Calcium Carbonate and HCl
Hydrochloric acid or HCl is a strong acid that donates H+ to water. Calcium carbonate, on the other hand, contains CO3 -2 ions -- the same carbonate ions we have if we remove H+ from bicarbonate. Calcium carbonate is ordinarily very insoluble in water, but it's increasingly soluble in acidic solutions. When we add hydrochloric acid, we dramatically increase the concentration of H+, to the point where more calcium carbonate can dissolve; moreover, we increase the rate of the reverse reactions so that we get first H2CO3 then CO2 and H2O. The ions left dissolved in the water are calcium and chloride.
Since the reaction basically occurs because of the increase in H+ concentration, you could achieve a similar result with other strong acids as well. That's why acid rain over time tends to degrade the surfaces of marble and limestone buildings: the calcium carbonate is more soluble in solutions with a higher H+ concentration, and it can also react in the same way as calcium carbonate and HCl. From Le Chatellier's Principle, we can also predict that the higher the H+ concentration, the more complete the reaction will be -- in other words, the less marble will be left once we are done.