They needed to remove carbon dioxide from the air. As the astronauts exhaled, the carbon dioxide accumulated and if left unchecked, would reach a high enough partial pressure that they would no longer be able to eliminate carbon dioxide from their bodies and take in oxygen.
The Apollo spacecraft (both the CM and the LM) used lithium hydroxide canisters for this purpose. As they became saturated in the LM, they needed to be replaced to continue working. But there were no spares available for the LM, as it was only intended to support two astronauts for a few days. Thus they had to adapt CM canisters to work in the LM.
The CM scrubbers could not operate, as the entire spacecraft was shut down. It could not use electrical power from the SM, as all the fuel cell oxygen there had been lost. The only electrical power it had available was in the reentry batteries, and they needed to conserve that for actual reentry.