Yes having unpaid hospital bills can eventually affect your credit score.
When you have unpaid medical bills eventually those unpaid medical bills and unpaid hospital bills will be sent to and sold to a debt collection agency for pennies on the dollar.
Then the debt collector will report the unpaid hospital bill debt to the credit bureaus.
When that happens a ding on your credit score will occur and your credit score will lower.
Even if you work with the debt collection agency your credit score still may not increase even if you pay the debt collector.
If you can't pay the debt collector it's best to not pay the debt collector anything or say anything at all to the debt collector as it will just harm your credit score even more.