In this study, the impacts of divalent ions (calcium and magnesium) on aqueous foam stability and its rheological properties are investigated. A biodegradable surfactant of alkyl polyglycoside, (APG) and a commercial enzyme (GreenZyme, GZ) are used and their performance were compared with synthetic surfactants of alpha-olefin sulfonate (AOS) and cetyltrimethylammonium bromide (CTAB). The findings of the study revealed that the stability of all foams decreased with increasing concentrations of divalent ions, GZ recorded the lowest foam stability in the presence of the two ions and precipitation occurred in the AOS solution. On the other hand, foams generated by APG achieved the highest stability and the foams generated by CTAB showed the second highest stability among the foaming agents. Through rheological analyses, APG and CTAB exhibited shear thinning behaviour and their behaviour were modelled using a power law model in which the model can incorporate the effects of temperature and salinity.