The 47-year-old "Pretty in Pink" and "Lipstick Jungle" star said the incident happened while he was researching an article for the travel magazine Afar, People.com reported.
"His gun (was) pointed at my back," McCarthy wrote in the issue of the magazine that went on sale Tuesday. "I thought his reaction to my offense was extreme; I tried to say as much. He grunted something in Amharic and prodded me with the tip of his rifle."
Some people outside the church helped convince the guard to free him, People.com said.
"(It) was just the kind of thing that happens when you show up alone in a distant country without a plan," McCarthy wrote.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Ray Liotta sues skin care company over use of likeness