Yes, this has happened. In 2018, United Airlines flight 1824 from Chicago to Hong Kong was turned around midair after a passenger had a severe case of diarrhea. The aircraft was diverted to Anchorage, Alaska, where the individual was treated by medical personnel. After the individual was taken care of, the flight proceeded to its destination.