The money does not automatically follow them. County jail and state prison operate on entirely separate account systems, and funds from a county commissary account are not transferred to the state when an inmate moves.
To get the remaining balance, the inmate needs to request a check for whatever is left in their county account. That check is typically issued to the inmate's home address, so there needs to be someone on the outside to receive it. The inmate or their family should contact the county jail's finance or commissary department before the transfer, or as soon after as possible, and request that the balance be issued as a check to a home address.
Once the inmate arrives at state prison, their account there starts fresh with no funds. Family will need to make a new deposit through the state DOC's approved payment method to put money on the new books.
The one exception is transfers within the state system. Once an inmate is in the state DOC and moves from one state facility to another, funds do transfer from facility to facility within that system. The county-to-state transition is the break point where the money does not follow automatically.