When an inmate has an active detainer or warrant from another state, that state is responsible for taking custody once the current sentence is complete. The process is generally well coordinated because the detaining state has access to the inmate's release date well in advance and plans accordingly.
Once the inmate finishes their required time, they are moved to the Admissions and Orientation area and held there while the transfer is finalized. The other state typically shows up on or around the actual release date, and it is not unusual for transport officers to be waiting in the parking lot before the paperwork is even complete on the releasing end.
There is no universal statutory deadline that applies across all states for how quickly a detainer must be acted on at the point of release, but in practice delays are rare because both sides have a shared interest in completing the transfer efficiently. The releasing facility wants the bed, and the requesting state wants its warrant executed.
The inmate does not walk free in the meantime. The detainer prevents release into the community regardless of how long the receiving state takes to arrive, within reason. If a state fails to act on a detainer within a reasonable period, legal challenges through an attorney are possible, but that situation is uncommon when the release date is known in advance.
If your person is approaching a release date with an active out-of-state detainer, prepare for the reality that release means transfer to another state's custody rather than freedom. How that matter resolves depends entirely on what the other state's case involves and what options exist for addressing it.