To prevent the chemical change due to the absorption of light.
This is because some liquid medicines and chemicals can react in the presence of light. When they are kept in dark-coloured bottles this helps to prevent the medicines to come in contact with the light.