James wrote fiction in an era before the modern technique of the "stream-of-consciousness" was established. In the modern technique, the author feels free to go inside the mind of the character. But in James' time, this was not yet an established technique. Thus, since James as a novelist wanted to remain outside the novel — that is, wanted to present his characters with as much objectivity and realism as possible — he created the use of a confidant.
The confidant is a person of great sensibility to whom the main character reveals his or her innermost thoughts (as long as they are within the bounds of propriety). The confidant is essentially a listener and in some cases an adviser. This technique of having a confidant to whom the main character can talk serves a double function. First of all, it allows the reader to see what the main character is thinking, and secondly, it gives a more rounded view of the action. For example, after something has happened to the main character, the confidant hears about it and in their discussion of the event, we, the readers, see and understand the various subtle implications of this situation more clearly.
The confidant is also a person who is usually somewhat removed from the central action. For example, Ralph Touchett is not directly involved in the central action of the novel, except that he does instigate the action by being responsible for Isabel's inheritance. Henrietta Stackpole, another confidante, is even further removed from the central action.
Essentially, the confidant observes the action from a distance, comments on this action, and is a person of exceptional sensitivity and perception, who allows the main character to respond more deeply and subtly to certain situations.