There are many reasons accounting for the fact that your eyes go out of focus and it is quite normal in the daily life. The tiredness of eyes can result in your difficulty in focusing on object. A migraine headache, as said by the ophthalmologist, can also cause the eye go out of focus. If you feel your physical condition is normal, you are probably suffering astigmatism, an imperfection in the curvature of your cornea or in the shape of the eye's lens. So, try to get enough sleep and if the condition continues, go to see a ophthalmologist.
Yes, it is normal for your eyes to go out of focus if you stare on something for a long time. As far as I know, it is just cause by the cranial nerve and eye nerve. When you stare on something for a long time, they are just too tired, too tight, and they are not relaxed. You need to relax you eyes and you can put some cold teabags on your eyes and relax them. Nothing serious, just relax for a while if they are tired!