Yes, you can reach Elephanta beach by trekking as well which will take 40-50 mins. time to reach Elephanta beach.
NOTE: If you go by trek, the return has to be by trek only. So make sure you plan to trek only if you are comfortable to do so for both ways.