The "Lock/Unlock" feature is enabled by installing a compatible Smart Cover/Case (or third-party equivalent) with an embedded magnet in the correct position in the cover. Are you using a real Apple product? If not, the cover/case you are using may not have the magnet in the right place or may not even have one at all.
If you ARE using a real Apple Smart Cover/Case and you have an Apple Store nearby, have them check both the case and cover you are using. You may have a bad magnectic switch on the iPad or a faulty cover/case.
I also remember reading here of a Smart Case/Cover which had the magnet installed upside-down and was repelling rather than attracting. You might want to take the cover off and flip it to verify this...you'll have to slide the cover around in different positions on the right-hand bezel on the iPad to see if you can activate the magnet.