I worked as a corrections officer for three years in the late 90's, at the local county jail. If an inmate couldn't make or was denied bail, they would be processed and placed with the rest of the jail population until they were either released by the court, eventually made bail, or their case was adjudicated. The jail had sentenced inmates, if their time was 365 days or less, if more they were transferred to the state prison. And of course the jail had pre-sentenced, pre-trial inmates that were denied bail by the court or couldn't afford bail. We had a whole range of offenders from murderers, rapists, child molesters, violent felons, drug dealers, mentally deranged (the deranged have provided me with a whole lot of interesting stories), all the way down to traffic offenders and DUI's. The intake process went like this:
After answering a whole bunch of questions at the booking counter, which included a medical history and any current illnesses, a CO would take the inmate's picture and fingerprints. Then the inmate would be escorted to a "changeover room" by a same sex officer. The room was actually two rooms. The first one contained plastic totes for the inmate's clothing, and the adjoining room had a shower stall, toilet, and sink. There was a camera fixed to the wall in the first room, positioned so it was impossible to see into the shower room. The camera was a result of a lawsuit filed by a former inmate that he was sexually assaulted by the CO that strip searched him. Anyway, the officer would stand in the first room, in sight of the camera, while the inmate disrobed, tossing their clothes into the plastic tote that was on the floor between the two rooms. The officer would then instruct the inmate to open their mouth, lift up their tongue, pull open their lips with two fingers to visualize the gums and teeth, lift up their arms, then turn around and lift one foot at a time, bend over and spread butt cheeks, then squat and cough a few times. After the strip search, the inmate was instructed to shower and then dress into the orange jail garb. While the inmate showered, the officer, wearing latex gloves, would go through the inmate's street clothes looking for contraband, before boxing them in a plastic tote that would be moved to a storage room later. Once dressed, the inmate took the bedding assigned to them along with a toothbrush and toothpaste, and was escorted to a cell in whatever cell block they were assigned, for example minimum/medium security, maximum security, special management, etc.
For senteced inmates who signed up for work details in the jail in exchange for time off their sentence, or were allowed to leave the jail to go to their place of employment to work, upon their return, the strip search was repeated every time. Same for any inmates who had what was classified as contact visits with any member of the public, including if the visitor was their attorney.
Cavity searches were extremely rare. In fact, I don't remember hearing about any during the time I worked there. By state law, a cavity search could only be conducted if there was enough probable cause to convince a judge to issue a warrant to conduct the search. An example would be seeing something poking out of an anus or vagina during a strip search. In that instance the inmate would be placed alone in a bare observation cell by the booking area and be constantly monitored while the sheriff petitions a judge for a warrant. If a warrant was issued, the inmate, by state law, would be brought to a nearby hospital. For the cavity search to proceed, the doctor, any attending nurses or orderlies, and CO's all had to be the same sex as the inmate. Only if the inmate didn't cooperate would force be used. And only after the doctor would inject a sedative to keep the inmate from getting violent, to protect everyone involved from getting hurt, including the inmate. The only contact the officers could make during the search was to help restrain the inmate if necessary. Only the doctor is allowed to glove up and medically inspect all body cavities.
As far as a physical is concerned, it was performed during the first day or two of the inmate's incarceration. A same sex officer would be in the exam room during an exam. It was very cursory, done while the inmate was fully clothed. BP, brief ascultation of the heart and lungs, and that's about it. If the inmate had any prescriptions from their doctor, or if the jail medical staff felt a prescription was needed, those would be administered at the required intervals during "medication call".
Correctional facility reality is very different from TV and the movies.