Not sure which aft cockpit hull the 38 Ocean was based on, possibly the 38 Holiday. Since you still have the shaft, you can identify if either of the below plans is an exact match.
Doesn't really matter very much if you can't find an exact match, as with the shaft intact you can just take the approximate shape and size off either of the plans and make two new GRP shells from that. The balance should be similar and the hull angle, the rest isn't dramatically important.
https://jefa.com/ftp/old_boat_spare_parts/Bavaria/Bavaria38Holiday_Z/Bavaria%2038%20Rudder%20type%20Z38-2000.pdfhttps://jefa.com/ftp/old_boat_spare_parts/Bavaria/Bavaria40_Ocean_P_2000-2003/Bavaria40_Ocean_type_P_2000-2003.pdfWhile you're at it, check the bearing housings and bearings themselves and replace as appropriate. The Jefa roller bearings are great, very low friction and durable.
Most likely cause for this sort of rudder loss is when the GRP halves split off, usually after impact, possibly long ago, followed by water ingress. That's something a pre-purchase survey should've picked up on though. How's the state of the remaining shaft tangs, are they covered in corrosion or clean? There's also always the chance of having hit something while underway that ripped them off.
Jefa can definitely manufacture the rudder for the 40 Ocean. They also can re-use the old shaft, although shipping that back and forth across the pond probably eliminates any potential savings.