This is partly for odd thoughts, mostly in hope that someone better educated in 3D math can maybe give a helpful suggestion.
I think that the function that needs to be changed is the function that generates the turret's rotation matrix. (This is multiplied against the orientation matrix to find the find the final rotation, along with other messy calculations.)
The relevant function, model_make_turrent_matrix. Note that sm-> represents the barrel, and sm_turret-> represents the gun base.
Both base and gun barrel have three rotation compoents, pitch, bank, and heading.
//Clear all turret angles
model_clear_instance(model_num);
//Find turret's 'f' vector (?) component of rotation matrix in world coordinates
model_find_world_dir(&fvec, &turret->turret_norm, model_num, turret->turret_gun_sobj, &vmd_identity_matrix, NULL );
//Set base heading to -PI/2 radians (or -90 degrees)
sm_parent->angs.h = -PI/2.0f;
//Set gun pitch to -Pi/2 radians (or -90 degrees)
sm->angs.p = -PI/2.0f;
//Find the 'r' vector (?) component of the rotation matrix using these two angle changes
model_find_world_dir(&rvec, &turret->turret_norm, model_num, turret->turret_gun_sobj, &vmd_identity_matrix, NULL );
//Set base heading to 0 radians (or 0 degrees)
sm_parent->angs.h = 0.0f;
//Set base heading to -Pi/2 radians (or -90 degrees)
sm->angs.p = -PI/2.0f;
//Get 'u' vector (?) compoent of rotation matrix using angle changes.
model_find_world_dir(&uvec, &turret->turret_norm, model_num, turret->turret_gun_sobj, &vmd_identity_matrix, NULL );
//Normalize all three vector components
vm_vec_normalize(&fvec);
vm_vec_normalize(&rvec);
vm_vec_normalize(&uvec);
//Copy normalized vectors to permanent location
turret->turret_matrix.vec.fvec = fvec;
turret->turret_matrix.vec.rvec = rvec;
turret->turret_matrix.vec.uvec = uvec;
My guess (after writing that up) is that for side turrets, I need to set te gun barrel to initially have a heading of -90 degrees (left side facing out) or 90 degrees (right side facing out) and use the difference for the 'r' and 'u' vectors. And for the base, start it out with the same.
As in, the default position would be the gun barrel sticking out to the side, and able to twist fore and aft. (But in order to twist up or down at all, the base would have to turn). Although the model I'm working with now seems to have it as the reverse; the barrel can twist up and down without the base moving, but not fore and aft.
Edit: Can't test this now, as fs2_open has started crashing every time I launch the test mission (seems to be an unrelated bug). However the headings have been changed, although I don't feel too confident of it being the solution. (Not to mention I also have to figure out which turrets are side turrets to apply this).
Edit 2: Here's my p/b/h chart. I keep getting them mixed up, so I'm not 100% sure of this, either.

