What happened is your iPad went to sleep or you tapped the lock button. There's an option to make the lock screen show a slideshow of your pictures. So:
To turn off the slideshow feature, when you are on the lock screen, look for the picture of the flower (should be by the slide to unlock bar). The flower will be white if slideshow is off, blue if it is on.
To adjust how long you iPad stays on without the screen locking, Settings->General->Auto-Lock. Set to whatever you want.