It means "only just" or "with difficulty", and is often used to describe someone who is alive but in a very weak or fragile state.
For example:
* "The injured hiker was barely alive when rescuers found him."
* "After the accident, she was barely able to walk."