Oxford Living dictionaries defines "pitch" as "An area of ground marked out or used for play in an outdoor team game." and mentions it is a British usage.
A definition of "court" is "A quadrangular area, either open or covered, marked out for ball games such as tennis or squash."
So a "pitch" is outdoors and for team games in BrE. In AmE, we would typically call that a "field". A court can be either indoors or outdoors and it's used for "ball" games. A pitch or field is typically grass or softer artificial surface better for running, and a court is often (but not always) a hard surface better for ball bounces. I believe courts are usually smaller than pitches.
Having said all of that, to correctly choose between "pitch" and "court" you need to know what sport is being played on it and what that sport calls their playing area.
Each sport has it's own terminology, and sometimes when a sport evolves from another sport it will carry the same terms with it. For example, indoor volleyball is played on a indoor, hard-surface court. Beach volleyball is still played on a "court" even though it is outdoors and in the sand. Arena Football is played indoors in a small playing area, but it is still played on a "field" (not a court) because it evolved from American/Canadian football.