Islam provides a set of rules for human beings to bring happiness here and the hereafter. One of the principles of Islam is preventing a Muslim from committing a sin or doing an indecent behavior from the beginning by blocking the means which leads to evil. In this regard, Islam put some restrictions between males and females to protect them from committing sin. For example, a man or a woman cannot touch to a opposite gender -unless they are married or they are closely related to each other- for it may arouse sexual desires and then they may commit a sin. Men and women are attracted to each other. Lawful way for them to benefit from each other is marriage. However, the modern age has brought many complex issues that Muslims need to know answers according to Islamic principles. Although it is not easy to answer them Muslim scholars should answer them according to their knowledge. After this introduction I like to answer the question as much as I can.
Firs of all the question has two parts; first, touching a person from opposite gender and second, practicing a profession as barber. In normal conditions it is not permissible for a male or female to touch a person from opposite gender but in this case it is different. Because, usually, when practicing a profession no one feels sexually aroused. Everyone tries to perform his/her work in the best way as much as they can. Similarly, a barber does not feel sexual when touching a client to perform his/her job. However, although it is very rare, it is possible a barber may feel sexually aroused when touching a client. In this case, if such barber is a Muslim he/she should perform some other professions which are safe to make money. So, I could say, it is permissible to work as a barber even if the barber touches to a person from an opposite gender. But, the final word or the fatwa belongs to the person herself for she knows herself better. I only provided principles to understand why an act becomes prohibited or permissible in Islam. I hope this explanation is sufficient.