Yes, the sentence is correct.
If you don't know the gender of the person, then feel free to use "they." It's been a common way to express the third-person singular of unknown sex for a long time.
You could also say "A person who helps you in your time of need is a true friend" and avoid the issue.
Student or Learner