Google is currently rolling out a new smart lock mode called on-body detection. The feature, described in the screens below, uses your accelerometer to figure out when your device is in your hand or pocket, and lock when it's not. The idea being if you leave your phone sitting on a table or forget it somewhere, it will lock, preventing would-be thieves from easily accessing your data.
Once you unlock your phone, it will stay unlocked while you're holding it or it's in your pocket. Once you set it down, it will lock again. Picking it back up requires you to manually unlock it (assuming you're not using another trusted authenticator factor). If you hand the phone to someone else while it's unlocked, it will not lock - the feature isn't able to recognize that you specifically are holding the phone. It just knows when the phone is being held / pocketed and when it isn't.
The device the feature was noticed on was a Nexus 4 still running Android 5.0.1, but we're now seeing it on many devices including most Nexuses. This doesn't seem to be a feature related to Android 5.1, but you probably need 5.0+ for it to work. We do know our tipster has the most recent version of Play Services (we tried with the same version on our Nexuses, and no dice), and we know trusted places is enabled by Google Play Services, so it seems likely this on-body detection mode is probably activated similarly, and isn't part of the core OS.
This appears to be Google slowly launching a new feature with a small rollout to begin with, so don't worry if you're not seeing it yet - we've got multiple confirmations it's out there.
Let us know if you're seeing this on your devices running the most recent (7.0.97) Play Services - we've got confirmation that it's showing up on non-Nexus hardware running 5.0+ as well.