Jails have nurses on staff to take care of any medical needs of the inmates.
When an inmate gets sick while in jail they're seen by the jail nurse who can give them needed medicine or treat them in other ways.
If the sickness is severe enough an inmate can be transported to the hospital but police will be along with the inmate during transport to the hospital and they'll also have guards with the inmate while the inmate is in the hospital.
But the inmate has to be severely sick to leave jail and go to the hospital.
Most times the inmate is just treated by the jail nurse.