lots of people are talking about shutter speed?!?! it has nuthing to do with it,
it is indeed depth of field as others are saying, and what you are talking about is a shallow depth of field. the shallower it is the smaller the plane of focus is. therefore like you wanted ur foreground will be in focus and ur background will be blurred. the broader the depth of field the more is in focus,
what ACTUALLY controls the d.o.f is the aperture NOT the shutter speed. which is the 'hole' in which allows light into the camera, the larger the aperture the more light is let through the camera the shutter speed will therefore probably be faster as a consequence. but only to compensate for the light.
so basically what you need is a camera where you can control the size of the aperture, either via a manual mode of aperture priority (noted by a A on the mode dial depending on ur camera)
if ur camera does not have this functionality and is fully automatic then you cant really achieve this effect. compact camera are also not very good at doing it because they dont have very large apertures compared to d-slr's, a way to combat this though is to tr and get the foreground as far away as the background as possible, for example a model in front of a wall.. just get the model to take a few steps closer to the camera.
just incase you didnt know.. the larger the aperture the smaller the f/ number is which represents it.. so if you do have a camera that you can control the aperture... set it to the smallest number possible