The rubber hand illusion (Wikipedia) involves touching both a fake arm and a subject's real arm simultaneously. This causes the subject to feel that the fake arm belongs to him. Normally a human delivers both touches, so the timing is approximate. I want to vary the latency between the fake touch and real touch precisely (~5 ms at minimum) to probe how close they need to be to create the illusion. What can I use to touch a human and fake hand lightly at variable but precise times?
What you want is a real-time system. Generally, you can do this either in a standalone or a hosted environment.
Standalone, otherwise known as bare-metal, means you write your code for a specific hardware, e.g. a microcontroller. That way, you have complete control of what executes and at what intervals, so you can be very precise. You can hardly go wrong with any microcontroller for such a simple task, so just choose one you like most.
Hosted environments means programming under a real-time operating system. There are a handful of those, but of course I would advocate free software. There are a couple of extensions for Linux that can make it real-time (RTAI, Xenomai, RT-Linux and others) and you can get precisions of even microseconds, which should be enough for your task.
Setting up a real-time Linux with proper configuration can be tricky, but once done the programming is easier and debugging tools are available. On the other hand, you can start programming a microcontroller right away and if you are experienced, not much more difficult than hosted either.
In the end it's your choice. If you feel comfortable with microcontrollers, I'd recommend a standalone application for your task.