I can think of two broad options.
(1) Leave the gap as a gap. Accept that some companies will filter you out and many will ask about the gap at interview. You could prepare a good way to explain when asked and the story might do you favours. But springing a big surprise in an interview can go poorly.
(2) Include prison as an entry in your CV. Solves the gap problem and the “springing a surprise at interview” problem. Probably increases the “getting filtered out” problem, maybe by a lot. But it might also help you quickly discover which companies are a good fit.
Best of luck.