It depends on the system. Within the same state prison system or the federal Bureau of Prisons, mail sent to a prior facility does typically get forwarded to the inmate's new location, though it can take additional time and the process is not always perfectly reliable. Within those systems, facilities are used to handling forwarding when inmates move, and mail generally finds its way eventually.
The situation is less predictable across different systems, such as from a county jail to a state prison, where the two facilities operate independently and forwarding is not guaranteed.
If you used InmateAid to send the letter and the inmate has moved, reach out to InmateAid with the updated facility information and they will resend the letter at no charge. That is typically faster and more reliable than hoping the facility forwarding process catches up on its own.
Going forward, confirm the current location through InmateAid's inmate locator or the relevant state DOC before sending future mail. Sending to the right address from the start avoids the forwarding uncertainty entirely.