Whether or not ants can harm you depends on a host of variables, such as the state of your immunity as well as the species of ants you are dealing with. Fortunately, the ant species that can cause serious harm to any human being are the minority.
For instance, a fire ant has a sting that delivers a toxin which can cause your blood vessels to dilate, leading to low blood pressure and eventually death. The fact that they often attack in packs means that this effects is accelerated. Fortunately, they are easy to spot and such cases are rare.
Generally speaking, ants that invade home may not do much harm to you directly, but they can sometimes indirectly compromise your health and safety. For instance, since the ants crawl around in many spaces, they could pick up various types of germs including E. coli and deposit them on your food. Consumption of this food will definitely lead to health problems including gastroenteritis.
Some ants such as wood eating ants may also damage the structure of your house particularly if it’s made predominantly of wood. Over time, they tend to eat up the wood supporting the house, which may eventually lead to collapse of part of the home. This will likely harm you if you are in the house.
In summary, the vast majority of ants may not be able to harm you directly, but could do so indirectly. This is why it’s important to eradicate them from your home once you notice them.