PCA can be used indirectly in supervised learning tasks such as classification and regression. When you have huge number of features, one way to reduce the number of features and probably avoid overfitting is using a feature reduction method such as PCA. Therefore, PCA can be used in preprocessing step to reduce the number of features.