In some cases, yes, infections can go away without treatment. This is particularly true of minor infections such as a cold or sore throat, which will generally clear up in a few days. Depending on the cause of the infection, it could also resolve itself without medical treatment.
For example, a minor cut or scrape might heal and the infection could clear up on its own.
However, many infections and conditions will require medical treatment in order to be properly cared for. This is especially true with bacterial infections and serious illnesses. If symptoms do not improve or worsen with time, seeking professional medical treatment is necessary.
Additionally, infections that are not addressed may result in more severe and long-term consequences, including organ damage or vision loss. Therefore, it is important to monitor an infection, and if it does not improve or worsens, to seek medical attention or treatment.