I had around 20 sheep in a pan with fences and when I came back to the pen from 4 hours of AFK fishing only two sheep were left. The pen was loaded the entire time.
Comments 2
Perhaps the pan got heated by the sun and then fried the sheep that were in it?
As @unknown said, if you're in an area where there are wolves, it's possible that those have slain the sheep by entering the pen somehow. Please make sure that there are no places in the fence where the wolves could have entered the pen.
Wolves could have spawned and killed most of them.