That's not at all my experience, the best PO I had were not technical at all, but laser focused on the users. They do need to be reasonably smart, and trust your technical expertise, however
They also need to be able to avoid making promises to customers and avoid falling into the trap of "This sounds easy and fast why are you telling me it's hard and time consuming"
I think it depends, a product owner needs to inject subject matter expertise. It can be that they know how to program, but it also could be that they deeply understand customers.
In digital health setting I’ve met a few drs-turn-pms who were excellent because they could translate between what drs wanted and what engineering was thinking in a way that swe-turn-pm would struggle. Of course, the best dr pm I know also learned how to program in python because he enjoyed it (and he even shipped some small self-contained projects!).
The least effective pm I met was a non-dr non-swe who didn’t have deep understanding of either side and essentially tried to apply general pm-principles-from-a-book. But even they were positive value after a quarter of finding their place.
I don't think the PO needs to program, it might help, but its not a necessity.
they do need to know the product inside out, and who the customers are, and why the product evolved like it did. They need to be able to advocate for the customer.