Whether or not foam arrows hurt depends on a few different factors. The type of foam arrow, the weight of the arrow, and the velocity at which it is shot all play a role in how much damage the arrow can do.
Generally speaking, light-weight arrows made of soft foam are not going to cause much pain if they hit someone. They may sting a little bit, but they're not likely to do any real damage. Heavier arrows made of harder foam can cause more pain, and even some bruising, but again, they're not likely to do any serious damage.
The biggest factor in whether or not a foam arrow will hurt is the velocity at which it is shot. If an arrow is shot slowly, it might sting a little bit when it hits, but it's not likely to break the skin or cause any serious injury. However, if an arrow is shot at high velocity - say, from a powerful air rifle - it can easily break the skin and cause bruises or even welts. So, in short: yes, foam arrows can hurt if they're shot fast enough. But for most casual purposes - like shooting at targets in your backyard - they shouldn't pose any real danger to you or anyone else.