Presumably unintentionally. Also presumably, would just go through without detonation.
Have there been? Yes. Definitely. The most famous case I'm aware of is when a C-7A from the 459th Operations Group was shot down over Ha Thanh. The aircraft (tail number 62-4161) was hit by a friendly 155mm artillery shell while on final approach to the airfield there. It was laden with ammunition for the special forces team based at Ha Thanh. The shell tore the entire tail section clean off. All three crew were killed in the incident. The incident is famous for being caught on camera but aircraft, particularly CAS, being hit by artillery, is not unheard of.
Another example I'm aware of is when an L-4 Grasshopper (basically a Piper Cub) was hit by friendly artillery over Normany while flying an artillery spotting mission for the 90th infantry division. It was at the time relatively common to fly spotting missions on the friendly side of the front lines to avoid ground fire, particularly in an L-4 which is a very slow aircraft and therefore an easy target (all spotter planes are). Both pilot and spotter were killed in the incident. Again it was a 155 mm US shell that brought it down.
So yes, it has happened. Whether or not hitting an aircraft would set off the shell or not depends entirely on what kind of fuse it would be equipped with and what kind of impact the hit caused. In the case of the C-7A it did not detonate the shell, in the case of the L-4 I don't remember. If you want to find out about that particular indicent it's in Eyes of Artillery: The Origins of Modern U.S. Army Aviation in World War II by Edgar Raines.