Even though attendance is voluntary, the prayer is unconstitutional because the attendees are forced to participate and because it appears to be a state endorsement of religion.
This would be considered as a violation of the freedom of religion in the first amendment of united states constitution since public schools are considered as a government owned institutions.