Not all bacteria is bad, it is only certain bacteria that are harmful when there are too many off them. Every human is a walking bacteria colony, some good bacteria, some bad. They are now using the fecal matter to get good bacteria for those who don't have enough, or the right kind of bacteria. They extract the bacteria, sanitize it and put it in capsules. Sounds disgusting, but works.
I don't think God designed it that way, but there is a purpose for at least some bacteria. I read recently that your poop is mostly dead bacteria, not the leftovers of the food you eat.