In this paper, we evaluate and compare the performance of three-dimensional (3D) sonoelastography for prostate cancer detection ex vivo and in vivo. Ultrasound (US) B-mode and sonoelastographic volumes were acquired from eleven prostate glands before and after radical prostatectomy. Semi-automatic algorithms were used to segment the surface of the gland from the US B-mode volume and the tumors from sonoelastographic data. To assess the detection performance, 3D sonoelastographic findings were compared in size and position to 3D histological data. One gland was discarded due to poor contact. In the remaining ten, both, in vivo and ex vivo sonoelastography showed similar performance in prostate cancer detection: over 80% accuracy for tumors larger than 4 mm in estimated diameter. These results are an improvement over US B-mode but not yet sufficient to replace biopsy. However, 3D sonoelastography has the potential to become an imaging tool to guide biopsies.