It really depends on the secret whether you should divulge it. If the secret tells you that a person is going to hurt someone or hurt him or herself, then you should tell someone. It's kind of like attorney-client privilege: there are some times when you have to break it.
I agree with those who say that the answer to this question depends on the nature of the information you have been given. If the secret given to you in confidence is personal and poses no harm to anyone, then you would be doing something most people would consider morally wrong to share this information with anyone. However, if in sharing this information you are protecting someone - the person who told you or someone else - then you can be assured that your act will be seen as morally appropriate.
There are three distinct situations in which you may or must or may not or must not divulge a secret confided in you. The first situation is this: If you are a member of certain professions you are bound by law to hold confidences therefore it is wrong and a breach of moral and professional ethics to divulge secrets confided in you.
It is equally wrong and morally unethical to divulge secrets confided in you out of a motive of maliciousness, pettiness or destructiveness, or even carelessness or irresponsibility. In other words, if your motive for divulging a secret in any way disregards the dignity of the other or actively seeks to harm in any way the other, it is wrong to divulge a secret.
The second situation, as others have pointed out, is when the well-fare of the other person or your own well-fare requires that you must divulge secrets to older, wiser, more authoritative or more directly concerned persons. One reason this is true is that your are first of all a co-partner in the individual's safety and well-being if a secret is told to you, thus your life would be forever marred with guilt if your silence made you a partner to harm befalling anyone.
The third situation is also one in which you must divulge secrets. This is when secrets are shared with little or no concern for the hearer. From such secrets you would be burdened with information not in keeping with your own well-being. In a more serious vein, a secret might reveal plans for malicious or illegal activity. In this case, the secret, if kept and not divulged, might make you an accomplice to the malice or crime.
As with many things, there is no absolutely right answer to this question. Others have pointed out the professional and ethical requirement that teachers sometimes have. But in situations not governed by professional ethics, the only way to make a decision like this is to consider the effect on the person who has chosen to share the secret. If you believe that actual harm might come to the person as a result of your decision to keep the secret, then there really isn't much of a choice. If not, then it is probably best to honor the confidence a person has placed in you.
I would agree that in most cases it is not. As a teacher, I am required to report anything that I find out about or hear about if it may cause harm to a student. I tell any student that I am a mandatory reporter (and explain what this means). Many know when they come to me that they "risk" the chance of others finding out.
That said, one must consider a secret. Is the secret something which can harm others or the person telling it? If so, it does not need to remain a secret. If the secret is "harmless," there is no need to divulge it.
In most cases I'd say yes, it's wrong to break a confidence. I'd qualify that for certain situations in which it is clearly in the person's best interest for you tell someone else, or if the secret they told you might harm someone else. As long as you're not a priest or psychologist, it's a judgment call on your part.
Sometimes it is wrong, and even illegal, not to divulge something told to you in confidence. I don't believe in gossiping or talking about people for no reason, but if I truly believe that keeping a secret could cause someone harm then I have a responsibility to expose that secret to the appropriate people.
As a teacher, this can be a dilemma for me. I think there are times when you must divulge a secret for the safety of others and/or the person involved. Many times student trust teachers with information about their families and what is occuring in the homes. Often times the information they give is of a secret nature but they are being harmed at the same time. This includes actions of physical and sexual abuse, rape, drug and alcohol, etc. When students report to teachers these kinds of actions, it is important to report it. I think this is also the case in any other kind of situation. When someone is being physically or emotionally harmed, it is necessary to report it so he/she can get help. Many times these people expect their secret to be kept, and although they may hate you for a while, but in the end you'll have saved his/her life.