Here are some common issues that can keep people for meditating and simple advice on how to work through them in order to keep practicing. This is all my opinion from my personal experiences and education but I hope it is helpful for others to have some suggestions.
First, adjust the posture as needed to not farther aggravate the pain including sitting in a chair or laying down. If lying down do practice at a time when they are less likely to fall sleep.
If it is difficult to focus on the breath during moments of pain, the pain can be used as a practice. Instead, of sitting with the breathe, the practitioner can touch the pain, feel it, experience it, let it go and then return to the sensation. Of course, one should make sure they are not adding to the pain either physically or emotionally. If meditation becomes too intense it is fine to take a break. Do not use meditation as a way of ignoring pain or the body.
Sleepiness is common in meditation practice. It can be another tool for working with returning to the present moment. We fall asleep, we notice it and then we return to breath. However, one way to combat sleepiness is picking a good time for practice when we are not exhausted and raising the eye gaze. Still, it is important to be accepting and gentle with ourselves therefore sleepiness can simply be used as another part of practice. Or a sign that one needs more rest.
Wild thoughts and fantasies:
In practice we work with thoughts by labeling then as thinking and returning to the breath. However, I was taught by one teacher if we are struggling with a persistent thought or fantasy that it might be time to have a thought party. Allow the thought to play itself out. Stop running from the thought, embrace, accept it, let it play out and when it is ready to be release, let it go and return to the breath or whatever the object of meditation is.