Bacteria are organisms that aim to conserve resources and energy as much as possible. When antibiotics are present, they must constantly manufacture and produce certain proteins such as penicillinase to protect themselves from the harmful effects of these antibiotics. This process requires a lot of energy to produce and can be physically damaging to the bacteria to be under that high stress. However, when antibiotics are not detected, the bacteria will choose to reduce the production of these proteins because their environment no longer demands them. This helps them to conserve energy.