Clothes moths can be a real problem in clothes made from natural fibers (especially wool). There are two different types of moth balls used to combat the moths. In one type, the main ingredient is naphthalene, and in the other it is paradichlorobenzene.
The idea with both chemicals is to kill moths and moth larvae with the fumes. Both naphthalene and paradichlorobenzene sublimate, meaning they transition from a solid straight to a gas. The gas is toxic to the moths.
For either of these chemicals to be effective, they need to be placed with the clothing in a sealed container so the fumes can build up and kill the moths. In a sealed atmosphere like this, the fumes are not harmful to people because they are contained. The main threat would occur when opening the containers, or from wearing clothes immediately after opening (especially a problem for infants). A solution is to open the containers outside and let the clothes hang and air out for a day before wearing.
We all seem to have an aunt whose entire house smells like moth balls, and we have all walked in to public restrooms where the smell of paradichlorobenzene is nearly overpowering. Are these fumes healthy? The answer is “probably not.” If you read the chemical descriptions in the links, you will find that neither of these chemicals is particularly good for people to breathe on a regular basis. Airing out clothes is a way to limit exposure.
A less toxic alternative is cedar blocks, shavings or oil. The blocks are expensive, but cedar shavings in the form of hamster bedding can be very inexpensive. Again, the container needs to be closed in order for the cedar scent to have a real effect on moths.