This had to be a possibility - an unguided splashdown location is very hard to predict and there is a huge flotilla waiting for it. Did NASA publish the probability of a capsule hitting a ship rather than water, how bad would it have been, and did they prepare the ships in any way for such an outcome?
In the Apollo era, landing guidance had gotten quite precise and there wasn't a "huge flotilla" waiting; Apollo 8's recovery force was the largest, with 6 ships waiting for it in each of two landing zones, but groups of 2-3 were more common. The recovery ships were usually positioned a couple of miles away from the designated landing point, and the Apollos all splashed down within 3 miles of the target. That works out to a minimum of around 30 square miles of area that could be hit; the area covered by aircraft carrier and a couple of support ships would be around 0.003 square miles, so I estimate an upper bound of about 1:10,000 chance that a command module would come down straight on top of the carrier.
However, the parachutes of the CM could be seen minutes before splashdown, and it would have been possible for the recovery ships to simply move out of the way if it looked like there was a chance of being landed on.
For Mercury, the landing point was much less predictable, but this actually means the chance of hitting a recovery ship would be much lower, since the potential splashdown region would be so much larger.
If such a capsule hit a ship instead of the water, the outcome would be rather unpredictable. The primary ship of each recovery force was an aircraft carrier with a large, flat deck; hitting this would be a rather unpleasant jolt for the capsule crew, but unlikely to cause any permanent injury. Hitting the superstructure or an edge of a ship might well result in the capsule tumbling before it came to rest, and anything not carefully stowed inside the capsule could potentially cause a more severe injury. (On Apollo 12, an improperly secured camera bashed Al Bean in the head at splashdown, requiring stitches, for example.) I'd think it unlikely that hitting a recovery ship would result in a crew fatality, but it's not totally out of the realm of possibility.