Mac OS X Lion allows users to password protect the system as soon as the screensaver begins or when the system goes to sleep. By default the password protection is turned off and you cab enable this using option provided as part of System Preferences.
Click the Apple icon and select System Preferences from the list of menus.
In the System Preferences window, click the Security & Privacy option under Personal section.
This would display the following Security & Privacy window. Mark the check box with label as Require Password.
You can also specify the time after which the password protection for screen saver and after sleep needs to applied.