ATMs are coming to criminal courthouses in Brooklyn, Queens and the Bronx as soon as next week to solve a basic problem—access to cash to pay bail.

Defendants who can’t immediately post bail are typically sent to the Rikers Island jail complex to await trial. But currently only the courthouses in Manhattan and Staten Island have ATMs, officials said.

“If...