How did shellfish and coral survive acidic oceans in earlier eras?
They didn't survive when carbon dioxide levels in the atmosphere passed certain thresholds in the history and increased ocean acidity significantly; leaving less carbonate for marine life to use for shells or skeletons. For example, up to 96% of marine life (including organisms with CaCO3 skeletons) went extinct in the Earth's most severe known extinction event, Permian–Triassic extinction. Another event called Paleocene–Eocene Thermal Maximum caused a mass extinction of benthic foraminifera.


  Five times in the Phanerozoic [the past 542 million years (My)], more than three-fourths of marine animal species have vanished in mass extinctions. Each of these events is associated with a significant change in Earth’s carbon cycle. However, there are a great many disturbances of the carbon cycle  whose imprint in the geologic record is almost exclusively environmental. These other events are relatively benign, with extinction rates barely, if at all rising, above background levels.
  
  Two well-studied examples illustrate these distinctions. The end-Permian extinction [~252 million years ago (Ma)], the most severe mass extinction in the Phanerozoic, plays out over a period of 104 to 105 years; the extinction interval immediately follows a perturbation of the carbon cycle of similar duration. The Paleocene-Eocene Thermal Maximum (~55.5 Ma) is a carbon cycle event of roughly similar time scale, with unambiguous signs of global warming and ocean acidification. It is associated with a significant extinction of benthic foraminifera, but there is no evidence of other major extinctions. What makes these two events so different? The unambiguous co-occurrence of the end-Permian extinction with massive volcanism provides one indication, as does the greater magnitude of the end-Permian carbon isotopic excursion compared to that of the Paleocene-Eocene Thermal Maximum. However, no general distinction, applicable throughout the Phanerozoic, exists.
  
  Thresholds of catastrophe in the Earth system 
  By Daniel H. Rothman 
  Science Advances | 20 Sep 2017 : E1700906 
  http://advances.sciencemag.org/content/3/9/e1700906.full
  
  (emphasis mine, removed citation numbers)


Here is an excerpt from a relevant study of Knoll et al. about the affects of end-Permian mass extinction on biomineralization  which includes the extinction percentages of animals that
form skeletons of calcium carbonate and vulnerable to elevated CO2
levels:


  Within the marine realm, animals with active circulation and elaborated gills (or lungs) for gas exchange compensate for elevated PCO2 better than organisms that lack these features. Also, animals that normally experience high internal PCO2 , including infauna and metazoans capable of exercise metabolism at high rates, tolerate experimental increases in carbon dioxide differentially well. And among animals that form skeletons of calcium carbonate, species that can exert physiological control over the pH balance of the fluids from which minerals are precipitated fare better than those with
  limited buffering capacity. Based on these features, Knoll et al. (1996) divided the Late Permian marine fauna into two groups, with high and low expected survival, respectively.
  
  As predicted, 81% of genera in the “vulnerable” group disappeared at the boundary, while only 38% of nominated “tolerant” genera became extinct (Figure 6A). The selectivity is even more pronounced when skeletal physiology is considered alone (Figure 6B; Bambach and Knoll, in preparation). Fully 88% of genera disappeared in groups that formed massive carbonate skeletons but had limited capacity to buffer fluids (sponges, cnidarians, bryozoans, calciate brachiopods). In contrast, groups that built skeletons of materials other than calcium carbonate lost only about 10% of their genera. Intermediate taxa—groups like mollusks that have a substantial commitment to carbonate skeletons but some physiological capacity to regulate the chemistry of internal fluids—lost 53% of
  their genera. Of these, those genera considered vulnerable on the basis of the other criteria noted above went extinct at twice the rate of those otherwise considered tolerant.
  
  
  
  Biomineralization and Evolutionary History 
  By Andrew H. Knoll 
  Department of Organismic and Evolutionary Biology 
  Harvard University 
  Cambridge, Massachusetts, 02138 U.S.A. 
  https://web.archive.org/web/20100620222809/http://www.geochem.geos.vt.edu/bgep/pubs/Chapter_11_Knoll.pdf
  
  (emphasis mine)