There may be several possibilities. For instance, perhaps something in the yard startled him enough to make him not feel comfortable going out. Is your dog a senior? If so, consider a potential beginning of cognitive dysfunction. At times, there may be medical reasons. Are there any new diet changes? Is there any chance he got worms? Anything that may cause an increase in motility/diarrhea can cause accidents. Can it be the doggy door malfunctioned and he got caught? Where is the poop exactly? If it's near the door, there may be chances he made an "attempt" to go out but was unable to which may point to a medical problem.