As was mentioned, you can turn off the pirate raids by using the "game options" button that appears when setting up the game.
If you choose to leave them on, you have two defenses:
1. Outbid other players so the Pirates attack them
2. Kill them when they show up.
I know 2 isn't as easy as it sounds, being a newbie myself.

The best way to do it is to make sure you get your free capital ship (the first capital ship you build costs nothing except the cost of the factory and supply). Which capital ship you make is up to you, personally for dealing with Pirates I favor the direct heavy hitters (like the Kol), while I find that the Carrier types just aren't strong enough at level 1 to deal with a Pirate raid (maybe if you can afford to train a Carrier to level 3 it'd be more worth it, extra fighters would help).
Research the Repair Bay technology.
Early on you'll want to use your ships to go out and take a couple of planets. When "Pirate Raiders are on the loose!" gets announced, you can use the Pirates button at the top (looks like a skull I think) to see who they're attacking. The person with a sword icon is the one the Pirates will come after.
If its you, send your fleet back to your home world (thats where they seem to attack most of the time for me). Build a repair platform or two (two with some overlap in their area of effect is very effective), and park your fleet inside the radius of the platforms. When the Pirates show up, the repair platforms give your ships a major advantage in fighting them. If you can kill them off, your capital ship will gain a lot of experience and probably a level. You'll probably have to do it two or three times, but each time you should be growing your fleet and trying to take more planets in between Pirate raids.
Another trick is that if you know where the Pirate base is (its a planet that has tons of Pirate ships around it, don't attack it without a big force!), you can snipe the Pirates off. For some reason I find that they often don't engage ships on the way to their target, they just keep going. So if you know they're coming after you, your fleet can meet them a planet or two away from your home world, take some shots at them, then follow them to your home world. That way you soften them up a bit before the fight really starts.
After a night of experimenting while dying to them constantly, I found that these tricks work for me (on Easy and Normal difficulties). Good luck.