Hi Ousamma,
Have you check if Rotation Lock is turned off. You can do this by going to Settings > System > Display and ensuring the Rotation Lock toggle is disabled. Next, open Device Manager and inspect the Sensors section. Look for entries like Intel(R) Integrated Sensor Solution, and if found, try uninstalling the device and then rebooting your Surface to let Windows reinstall it automatically. Also, expand the Firmware section and check for any warnings next to Surface System Aggregator a yellow triangle would indicate a problem. Let me know if you still experiencing the same issue after this.
Best,
Jeric