The other answers are okay, but are not comprehensive, so I thought I'd take a shot at giving you some more options.
Obtaining ore is one of the biggest motivators for exploration in Terraria. Without ore, you can't upgrade your gear. Without gear, you're unable to progress effectively.
So where do you get the most ore from? As other answers have stated, in the beginning of the game you're quite limited. You have to travel underground and mine out any small pockets you find. Occasionally, you'll find chests - these chests usually have a few ores in them as well. Slimes also rarely drop ores, though I wouldn't recommend this as a primary source of resources.
This process of mining out small patches of ore in random parts of the map can be tough and tedious... especially after beating the Wall of Flesh, at which point you break demon altars to spawn more ore randomly across your map and you have to backtrack and re-mine everywhere. Luckily there is a potion that can help - the Spelunker Potion. This potion highlights all treasures (including ores) on your screen, regardless of whether behind walls or not. This means that not only can you make a beeline directly toward any ores you see, you can focus on only mining the ones you want.
Another way to obtain ores, as synobeam mentioned in their answer, is through the use of the Extractinator, which converts silt and slush into coins, gems, and ores. Though the rate of return is a little low, it's still a nice boost and silt/slush is easy enough to collect.
Probably the most tedious but efficient ways of getting ore quickly is to go fishing. When you catch a fish, it has a small chance of being a crate instead of a fish. This crate, when opened, has a chance of dropping ores or even full bars of various metals. In fact, it is considered a very effective way to start hardmode with a collection of a hundred crates - this way, when you open them all, chances are quite high that you will end up with enough bars/ores to craft a full set of adamantium/titanium armor. I've done this several times in several playthroughs - it's nice to be able to completely skip the risk of breaking demon altars.
Of course, there are a few ores which can be obtained in slightly more effective ways. Demonite ore, for example, is primarily obtained by defeating the Eye of Cthulhu and the Eater of Worlds. Chlorophyte can be mined in the jungle, but it can also be farmed (see this guide or the wiki for an explanation of how). And finally, Luminite ore (the strongest in the game) can only be obtained by defeating Moon Lord.