I am so sorry for your sad loss!
It sounds as if your dog may have had a rectal prolapse or an intussusception.
A definition of intussusception is the telescoping of the intestine within itself. It can occur anywhere in the intestines from the small intestines to the colon. The colon leads to the rectum, and can actually come out of the rectum, as happened with your dog. When the intestine slides within itself the blood supply to that telescoped section is compromised, and the tissue begins to swell and then die, causing blockage of blood circulation in either direction, resulting in ischemia (drastic reduction of blood supply) and death.
Rectal prolapse is the telescoping of the colon through the rectum.
Both intussusception and rectal prolapse occur from severe infestation of intestinal parasites, bacterial or viral (Parvo or Herpes virus) diseases in the gastrointestinal system (GI), cancer of the intestines, foreign body ingestion, GI toxins, or poisons, congenital rectal problems, and inflammatory bowel disease, and other unknown causes.
Severe straining to defecate, plus the compromised blood supply can eventually lead to the prolapse (intestines coming out of the rectum). The straining can occur with any of the diseases (and more) that I have listed above.
Only a veterinarian who examines your dog's body would be able to give you a definitive cause, however.
wow so sorry, did you take to vet or call and ask your vet what they may think?