Yes, a clause in a separation or release agreement, or confidentiality or non-competition agreement, that you will not speak with customers, prospects, employees (or their respective families) is legal; the law does not prohibit such restrictions or limitations on contacts, so long as you in fact clearly agreed to same, such as by signing an agreement (i.e. they cannot be retroactively or unilaterally imposed on you without your consent).