You only get on the horse if you're aiming at it, but you will pick up the a body if you are just near it. So the solution is to look away from the horse and press E.
There isn't really a prefect solution, I could make it so picking up bodies takes priority over getting on a horse, but then it would be really hard to get on your horse when there are bodies near by.
Well, I suppose I could make it so that if a police officer clubs a criminal, then they're allowed to get on that criminal's horse without it counting as theft.