It's not a law, it's a privilege that is offered to inmates with more than a year on their sentence with approval from the warden.
https://www.inmateaid.com/ask-the-inmate/can-inmates-get-married-in-california-prison.amp#answer
Accepted Answer Date Created: February 08,2016