A lot of cameras can be controlled from a computer. Not sure if every camera out there can, but at least in my experience, every camera I used did.
I'm sure about DSLRs: all the DSLR cameras from Nikon, Canon and Pentax have such features. I also know for sure that Canon DSLRs are sold with EOS Utility, that allows you to control the camera from your computer.
Most of them use a protocol called PTP to talk to the pc, so you just need something on your pc that talks ptp to your camera (or more recently MTP). Looking at this page you can see that there are several projects and libraries to talk PTP (anyway most of them seems obsolete, anyway).
You may try gphoto. I've got very good experiences with it. It gives you some libraries to make your pc talk to a lot of cameras, and even a command line utility to test it out that you can use even in shell scripts. I always happily used it with unix systems, and it's included in any linux distro (don't if it works with Widnows).
If you need to buy a camera, and like to use gphoto, you may look at gphoto's list of supported cameras, so you can get something that works fine with it.