On the E39 when you get a gear speed monitoring fault this is the process that must be followed.
1. Check the fluid level. If it is ok then you are looking at a transmission.
2. If you have recently had a service on the transmission then reset adaptations.
Usually there is not much that can be done. I have tried reprograming the ECU and reseting the adaptations on cars with this fault. 99% end up being a trans.
-Adrian
BMW Technician
5 years BMW master