Part 1: Detection
Early detection is a key.
The 1st thing you MUST do is scouting (getting map vision) and looking at the mini-map. You can say, that is hard. No, it is not correct. It is VERY hard. And it is very important. If you are controlling a XelNaga tower (usually they are located in the map center) but not looking at the minimap - that gives nothing to you.
Try to put pylons on the edges of your base. Outside of the base... You will see much more area and will have much more time to react. Often opponent forces (Mutas, Banshees, etc) are send with 'Attack' command, then they will begin to kill your cheap pylon (with 400 HP), instead of expensive probes that are slow to be build.
Also good to have a few observers patrolling the edges of the opponent's base. In this case you will see out-coming dropships.
Part 2: Early prevention
If you have some air units - it is always good to harass dropships with them. If you are building for another army - don't keep you air force in center of the map. Put few phoenixes patrolling those ares that are not covered with XelNagas/Pylons.
Besides scouting they will often kill those dropships... and give you time to react if they are overwhelmed by other units (mutas, vikings, Voidrays, etc).
Part 3: Saving probes
Once medivac/WarpPrism/Overlord/NydusChannel/Mutalisks/Banshees, etc detected:
As other answers tell: get you probes out first. Be sure they are not currently attacking. To do so select all of them with BIG BOX and right click on the minimap to he most defendable place in your base. Usually that is your gateways' rally point, or location where the army is concentrated.
If your probes are followed by hellions - that won't help too much: hellions kill "lined" probes easily. Try to split your probes in a few (2-3) groups and send them to a little bit different directions.
You also need to do that quickly, each second of delay could cost you an additional probe lost.
Part 4: Take your army to deny aggression
Once you have detected that the opponent is doing a drop - don't panic. Don't pull ALL of your army to mineral lines. If he has 1 medivac - just take 8 stalkers. Ok, you can take 12, but not ALL 30!!! Otherwise he will do a front attack (it is not a case on Bronze level, but if you are asking here, guess you are going to be at least gold, right?).
It is good to bring some flying units too. Even though stalkers often are good to kill opponent's ground army, you will want to kill their air too. But while stalkers are shooting the ground - air forces could withdraw.
As Protoss you have Warp Gates. Usually, that is one of the first technologies to be researched. Therefore, after you have ordered your army to attack back to the mineral line - warp-in all stalkers that you can.
Part 5: Restoration
Take all your probes back to the mineral line. DON'T forget about gas!!! (usually people forget about and are left with no gas..)
Build new probes (you should do that constantly, but currently is a good additional check-point for that).
Analyze if it is possible to make another drop through the same way. If so - build at least 1 cannon. Probably two - but not more.
Analyze if there is another way to made a drop. If so - build at least 1 cannon there.
If you have at least 1 expand - it not a a big deal to have 2-3 cannons to defend the mineral line. If you have 2 or more expansions - it is ok to have 2-3 cannons to defend it right after building (it will pay for itself quickly, and usually 'late'-expansions are far away from your base and are hard to defend.
Don't over-invest in static defense (otherwise, if you build 5 cannons per mineral line - your opponent will have 750 minerals more in the army - 7 zealots or 4-5 stalkers);
Don't invest in static defense too early
I wouldn't recommend to keep your army in the mineral line in general. But there are few exceptions. If you have detected opponents medivac/warpprism leaving base, but not sure from which direction to expect a drop. In this case it will be reasonable to get your stalkers back to the mineral line for some time. But right after that I would add some cannons (1-2 - not more). For bronze/silver level - that is ok, later you will learn how to prevent expected drops without cannons.