Option 1: Take a photo
is that all they do?
Well, this is simplistic. Taking a picture is not point and shoot. The lighting should be right, probably you do not want shadows, or probably you want them. So there could be controlled lighting.
But you can also extract 3D information from the photoshoot, for example, different lighting setup for a normal map.
Another process would be converting it to a seamless texture, so this is a strong post process.
Option 2: Paint it
2D paint is a beautiful craft, it can be done for backgrounds, the same way matt painting is done for a movie.
Option 3: Generate it
A lot of textures can be procedurally generated. Noise, strings, gradients, another type of noise. Add some blending modes, add more procedural nodes, and you have them.
Some programs to do this are built inside the 3d program like in Blender or can be standalone. Substance painter, Filter forge, Genetica, etc.
A texture is not just a texture, but a series of them. Diffuse map, bump map, normal map, specular map... Depending on the software you get just the diffuse map or you generate some more of them as different files.
Option 4: Draw it
Some textures are really simple. Some rectangle with color can be a diffuse map. This type of texture can be done for mechanical parts. One canal here, some bolts there.
Option 5: Cook it
Sometimes you generate a 3D model, and extract a map from the generated render and use it as a new 2D texture, mostly done to accelerate render times.
Option 6: Sculpt it
In sculpting tools, you can sculpt details, and in a similar way than the previous one, extract the rendered information to generate a texture.
Option 7: 3D paint it
It is like using an airbrush on a 3d model. Normally is for general gradients.
Option 8: Combine them
You can make use of whatever resources you have. A texture can be applied in a different way than first planned.
Here is a little tutorial I did some time ago, using just 1 texture and transforming it into rust, scratched paint, and dust.
Overlay to make image look dusty with fragmented text
Option 9: Use pre-made materials
You can buy photos, not necessarily taken by you.
You can use materials already made by someone else, using prepared maps.
You can use a library especifically made for your 3D aplication.