Hi. My name is Vinay. Let me see if I can help you figure out what needs to be done here.
First off, difficulty with vision is a scary thing and I want to make sure that you are not putting yourself in danger by driving or operating heavy machinery while this pain, headache and vision issue is going on.
The muscles that control your eyes and their movement are controlled by nerves that go directly into the base if your Brain. The muscles themselves are tiny little slips of tissue that are amazingly well co-ordinated when in motion. Now the thing is.. You have said that you can't actually move your eyeballs in either eye to the left and to the right. If that is the case.. and this is a new thing for you... Then you need to get to the ER right away! There are a number of infections and nerve issues that can cause symptoms like that and none of them should be ignored.
On the other hand.. if you actually can move the eyes in all directions but that seems to make your
headaches worse.. then i'm going to think that the muscles and nerves are fine.. but it's your vision and corrective eyewear that needs adjustment... That means.. first stop to the Optometrist to get your vision checked and eyes tested. If they show you that an alteration of your prescription can bring the headache down.. Well then Yahtzee! You saved yourself a trip to the Docs Office.
Either way.. this needs to be looked at by a professional. I'd make that appointment right now if I were you.
I sincerely hope you feel better soon and this information helps you tword that goal, feel free to contact me through HCM if you think I can help you any more.
Vin