Even when you restart your tablet, some of the settings can stay in the system.
To enable screen rotation, access the "Notification Curtain". You do this by swiping down, from the top of the screen. Touch the "Screen Rotation" icon (it looks like a lock encircled by arrows).
This should unlock screen rotation and allow the screen to rotate when the tablet rotates.
If that doesn't fix it, the accelerometer (the part inside the device that recognizes the movement) may be defective or damaged.
However before trying that, you can (if you wish) try installing an app that will allow for manual rotation of the screen.
If you feel it is the accelerometer, the motherboard may well have to be replaced. If you feel comfortable trying to fix it/replace it yourself, then you can find loads of instructions online to do so. If you don't feel you could, then I would suggest you check for a repair place in your area.