Many things can happen whilst meditating.
When there are pleasant sensations, you might develop a long fantasy about how close you are to a “big experience.” When there are unpleasant sensations, you might convince yourself that you will never be able to meditate, and in fact need to go to a hospital.
Your attention will naturally be drawn away from the sensations of the breath to other sensations in your body, especially pain. It is important to learn to be steady through uncomfortable sensations. Sitting still contributes greatly to peace of mind. It is equally important not to cultivate a tendency towards strain by forcing yourself to sit through unbearable pain. Be patient and kind to yourself. You will learn when to sit still and when to move.
Bring some interest to the actual physical sensations. What do you notice about the sensations when you bring your awareness to it?
See if you can tell the difference between pain as a sensation in your body and the reaction to it in your mind: the unpleasant feeling-tone, the thoughts, etc.
It can help to label the sensation with the noting technique. Words like "burning", "tingling", "cutting", or "twisting" describe the sensation more clearly than the general word, "pain".
If the pain gets more intense, try relaxing more on the out-breath and breathing into the pain. Or you can try "sweeping" your attention through your body from the top of your head to your toes.
Feel free to change position if the pain becomes unbearable.
You may sometimes experience pain not as something solid but as changing, flowing sensations.
As soon as the sensation no longer draws your attention away, return to the sensations of the breath.