Does a laser beam have to hit the eyes in order to damage them? Does a laser beam have to hit the eyes in order to damage them?
Or can a persons eyes get damaged by looking at a beam that goes past their eyes (e.g. looking at a laser beam moving inside an enclosure)?
If just looking at beam that goes past a person can damage the eyes, what factors would affect whether it is potentially dangerous? (like how strong would the beam have to be and how long would a person have to keep looking at it?)
 A: The Wikipedia article on Laser Safety completely covers how lasers damage the eye, what types of lasers there are (in terms of damaging potential), and other related topics. So I'll give the brief summary of relevant info here.
There are 4 main classifications of lasers (aptly named class 1 through class 4).
Class 1 lasers are completely safe. This is usually because the laser beam itself is hidden, but for class 1 lasers with open beams, you can stare into them as long as you want without damaging your eye (unless you do something stupid like focus the beam with a telescope).
Class 2 lasers are safe because the time it would take to damage your eye if looking directly into it is greater than the time it takes for your brain to say "Ah, bright light! Blink, you dummy!" and then carry out the blink, thus protecting your eye. Again, don't be stupid and look at the beam through a magnifying glass or something.
Class 3 lasers should be handled carefully. They can damage the eye if you directly view the beam (although the low-power end of this classification carries a low risk of eye damage). It is perfectly safe to view the diffuse reflection of a class 3 laser (that is a reflection off a non-shiny surface. It is also perfectly safe to look at the beam indirectly (such as using mist or smoke to illuminate the beam path). Protective goggles are a recommendation when there's a chance of directly viewing the beam (that is, putting your eye right along the path of it).
Class 4 lasers are the most dangerous. Anything too powerful to be a class 3 is listed as a class 4. You can damage your eyes by looking at a class 4 laser beam in any way (directly, indirectly, even looking at the laser dot on a surface can damage your eyes). Protective goggles are always required. Class 4 lasers can even burn your skin or clothes and ignite combustible materials. There is little chance of most people encountering a class 4 laser, but if you do, make sure you are protected, don't walk in front of the beam, and most importantly, don't be stupid.
The main factor in determining the class of a laser is its output power. Class 2 lasers don't go higher than $1~\rm mW$. Class 3 lasers are separated into 2 subcategories; 3R for lasers below $5~\rm mW$, and 3B for lasers up to a continuous beam power of $500~\rm mW$. Above $500~\rm mW$ is class 4 lasers. I've worked with a few class 4 lasers myself, the lowest power one was $700~\rm mW$ and the beam was warm to the touch even then. So above $500~\rm mW$, no-touchy.
A: Some of the light from the laser beam must strike your eye to do any damage, but if no light is reaching you you cannot see the laser at all. Laser light can be scattered from imperfections or dust on mirrors or other surfaces and this is generally what you see when you see a laser spot. If there is sufficient energy in this scattered light then it can still damage your eyes.
As Jim mentioned there are several classes of laser. Class 3 can damage your eye if viewed directly but not from scattered light. Class 4 lasers are more powerful and even diffuse reflections can be dangerous.
If you are using classs 3B or 4 lasers you should wear the correct lasers googles when using the laser and propably go on a laser safety course.
A: Infrared lasers are used for industrial metal cutting. These lasers will badly harm any part of your body exposed to their light. kW infrared lasers are tested as weapon systems as well.
A: Jim's answer already talks about laser classes, which are important to think about if your concern is the danger from laser pointers or their applications (rifle boresighting, rangefinders, red dots, &c). For any military, scientific, or commercial laser provided to you with its own inclosure though, it's almost always going to be a class 4 laser as it comes out of the tube.
Your specific question

Does a laser beam have to hit the eyes in order to damage them?
Or can a persons eyes get damaged by looking at a beam that goes past their eyes (e.g. looking at a laser beam moving inside an enclosure)?

is nonsensical as asked. Of course the laser beam has to hit the eye in order to damage it and a laser completely inclosed within its housing can never make contact with the eye or damage it in any way. If a laser is firing within a steel box, looking at the steel box isn't going to hurt your eyes at all unless the room is too bright or the steel starts to glow as an extrapowerful laser makes its way out.
Just as clearly, though, what you're trying to ask is how strong does a laser need to be to hurt you from its reflections. If you're looking at a laser as it works, most of its power is going straight down from the focus lens into the material but there's a nonzero amount of power being reflected from the surface to everything line of sight around it. If you're shooting a CO2 laser into something nonorganic and highly reflective like polished aluminum or some mirrors, there will be a large amount of power reflected.
I don't have enough credit on this stack to downvote Jim's answer, but it's misleading to the point of being wrong. What's dangerous is laser density at organic-affecting wavelengths, not just raw output power out of the gate. Case-Western Reserve University in Cleveland has a laser safety guide that covers most of the important points from the relevant American standard ANSI Z136. There are some minor differences between that and the EU standards IEC 825 & 60825, but ANSI itself has mostly adjusted its ideas to match Europe's and most differences in American labelling (labels talking about Class IIIb and Class IV instead of Class 3R and Class 4 eg) are down to the US government not having updated their implementation of ANSI's suggestions in 21 CFR 1040. (Paragraph d in Subsection 10 does have pretty thorough and freely available charts of the wavelengths, intensities, and durations that produce dangerous laser densities though.) In any case, infrared lasers above 500mW are labelled Class 4 because at that level of power they can cause severe eye damage within a fourth of a second, quickly enough that it's impractical to expect anyone to be able to react quickly enough to avoid damage. Similarly, Class 1 lasers are so harmless they can be viewed indefinitely long without any expected damage even if focused (eg through a microscope or telescope). Whatever power they have is incapable of harm or even when focused dissipates harmlessly in human tissue as a matter of course.
Class 2 and Class 3 lasers, however, aren't necessarily harmless if they are focused or viewed for extended periods of time, allowing the laser's density to build up on the exposed surface. Similarly, under current regulations, a Class 4 laser can be incorporated into a product that as a whole is considered Class 1 if its cover has an interlock switch that automatically cuts power when the case is open. Such "Class 1 laser systems" or "products" can still expose operators to Class 4 levels of damage if there's a viewing window in the cover that doesn't provide high enough optical density (OD) protection at the laser's wavelength. Even if the operator's window or own eyewear offer high OD protection at the correct wavelength, strong enough reflections from a Class 4 laser can still do damage over time as the transferred energy builds up into a small enough space on the cornea or retina. Follow the instruction manuals and warning signs, especially around commercial systems with a financial incentive to game certification requirements: ALWAYS wear suitably protective eyewear for the correct wavelength around strong lasers and NEVER stare at the active laser, even through protective covers and eyewear. (Yeah, you could theoretically do the testing for the exact levels of reflected IR light for your system and do the math about the energy density being transferred to your cornea and focused onto your retina... but better to just be nearby, check periodically if there's a fire or other problem, and otherwise look somewhere else while it does its thing.)
A: Here is the authoritative, perhaps complex, answer:
https://www.lia.org/store/ANSI+Z136+Standards
Lasers come in many wavelengths, EVEN THOSE our
eyes cannot SEE. Nevertheless they can all hurt
retinal neural tissue, the "video camera" built
into our eyes.
An illustration: Let's say you have a smart phone,
whatever kind. Usually you aim it so that the most
important part of the shot is in the center. Now,
imagine that, for some reason, the center of the
light sensor has a defect and records only black.
Would you keep that smart phone, or give it back
for a new one? Of course.
But since it was designed into your head, you
cannot give it back broken (to whom?). If you
are lucky you have a second healthy eye.
So:
Don't look into a laser with your remaining eye.
