For the words ending in -cia and -gia the rule is as follows: if these sounds are preceded by a vowel, they keep the "i" also in the plural form. For example, if we think about the word "farmacia" (pharmacy), we can see that the vowel "a" precedes the sound "cia". For this reason, the plural will be: farmacie. That is also a good example to remember, since the "i" in farmacia is stressed, which suggests that the plural form should be the one mentioned above. Another example is given by the word "valigia" ( luggage). Again, since the vowel "i" precedes the sound "gia", the plural form will be "valigie".
On the contrary, if the sound -cia/-gia is preceded by a consonant, the word will lose the "i" in the plural form. For example the word "pioggia" (rain) has a consonant before the sound "gia". For this reason, the plural form will be "piogge".