Hi!
For how long the pain lasts? Does he feel pain and discomfort after the episode? Is he experiencing some difficulties during defecation? Does he have constipation problems? Has he noticed blood in his stool?
Very often is difficult to diagnose the source of the pain, because it can be relate with different causes.
It may occur with diarrhea and constipation, or with hemorrhoids. Anal fissure, that occur as a consequence of constipation or sometimes of diarrhea, is causing a pain, because it is a small tear or break in the wall muscles in the area. Spasm and tenderness in the group of muscles that surrounds and supports the anus can lead to rectal pain. Sometimes injured and weak ligaments can cause pain, too. Less likely causes of rectal pain include inflammatory diseases such as Crohn's disease and ulcerative colitis, infections, cancer, rectal prolapse and foreign bodies in the rectum.
If your husband has sharp pain that lasts from several seconds to several minutes and after that pain moderates into a dull ache that lasts for hours, probably a anal fissure is involved.
You've mentioned that he was suffering from depression. Has he been treated with medication? If he takes anti-depressants you should be aware that they can cause constipation as a side-effect.
You have probably already visited the doctor. Please, write me back about doctor's appointment.
All best to you and your husband!