Whether or not you are required by law to share your HIV status depends on where you live. Some states and cities have partner-notification laws. This means that if you test positive for HIV, you (or your doctor) may be legally required to tell your sex or needle-sharing partners.
In some states, if you have HIV and don't tell your partner(s), you can be charged with a crime. Some health departments require doctors to report the name of your sex and needle-sharing partner(s) if they know that information, even if you refuse to report that information yourself.2
Some states also have laws that require clinic staff to notify a person if they know that person has a significant risk for exposure to HIV. This is called "duty to warn."2