Hello - my iPad Air 2 on iOS 10.2.1 has occasionally shown the same behavior probably since first upgrading to 10.x - likely a bug in the device (accelerometer and/or the iOS installed) - some discussion
HERE; also, if you simply google 'ios 10.2 ipad locks orientation', plenty of similar hits will be listed.
Nothing seems to be specific to help, either in settings or in manipulating the buttons - I've eliminated the locked orientation in a variety ways, e.g. sleeping/awakening (while closing & opening my smart cover), performing a restart, or less often doing a reset which is the most irritating - cannot add much more that the information found in the search suggested. Dave