Yes, you can. The Palace of Fine Arts is a popular wedding venue. However, it requires a permit from the San Francisco Recreation & Parks Department. Permits are competitive, have strict time limits, and carry fees (typically $200–$600+ depending on guest count and duration). You must also hire a city-approved event monitor.
While "difficult to obtain" due to high demand, it is absolutely possible with advance planning (often 6–12 months ahead).