Meds are not hard to get dispersed in a jail when they have been previously prescribed.
Or even when there is obviously some kind of problem when a person is booked. Here, and I am sure it is pretty common everywhere, you have a medical visit within a few hours of being booked into the jail no matter if you are there for public intoxication or murder.