Courts do appoint pro bono attorneys in felony cases. The Sixth Amendment of the United States Constitution guarantees someone accused of a crime the right to counsel. The term pro bono refers to doing work for free, especially legal services, for the greater good.
The Miranda rights which are read to any person inside the U.S. when they are arrested or taken into custody also clearly says that if a person cannot afford an attorney one will be appointed to them. These lawyers worked with no compensation up until 1966 when the Criminal Justice Act was put into effect, which ensured that attorneys were compensated for their time and work on any cases that they were assigned.