Not usually, they are almost always fixed to the same shaft so that the turbine drives the compressor directly. That means, in the same direction.
The high-bypass geared turbofan does exist, but is unusual. And even there, the fan provides minimal compression; one or more further compressor stages are still mounted on the main shaft.
You may perhaps be thinking of the two-spool turbofan, in which a first-stage compressor, inner shaft and second-stage turbine are followed by a second-stage compressor, outer (cylindrical) shaft and first-stage turbine. The two spools spin at different speed.
But even here, they usually turn the same way. A few designs do buck the trend and spin them opposite ways, see Why are contra-rotating jet engines so rare?
The turbine blades tend to resist the air flow and deflect it tangentially, while the compressor blades tend to push it backwards and (if they spin the same way) deflect it in the opposite tangential direction. The fore-aft effects in part cancel out, leaving the rotor in a state of net tension (and net thrust on the fan/compressor blades). In steady operation at constant revs, the torque effects are (of necessity) equal and opposite. They do create a net torque on the shaft, which it must be strong enough to resist. Stator blades may protrude in from the casing to counter the tangential gas flows; again, if properly designed these will result in zero tangential flow and the casing will also experience some twisting but, overall, the air will not.
A counter-rotating fan pushes the air tangentially in the same direction as the turbine. If this is not carefully countered by compressor blades attached to the turbine spool, it may create wasteful spinning and turbulence in the engine wake. The fan transfers its torque through the gearbox to the driving turbine, and vice versa. Because the gearbox reverses the torque, perhaps paradoxically the torque acts in the same sense on both shafts. But overall, whatever the configuration, torque cannot be transmitted between the spool and the casing unless the engine revs are changing. The main difference is that the thrust of the fan is decoupled from the drag of the turbine. Depending on where the thrust bearings are located, this may affect whether the thrust loads are carried by the shaft, and what their path through the casing is to the wing mounting point.