I know, right? It’s actually pretty straightforward: your finger changes color slightly as the capillaries inside expand and contract with each heartbeat. Under bright enough light, these color changes are easy to detect with the right algorithm. Instant Heart Rate uses the camera feature (and your LED flash, if you have one) to average out your heartbeats per minute.
The App is called Instant Heart Rate and you can get it here.
I've compared this to an actual heart rate monitor I own and the results are surprisingly accurate.