For many years, amino methylenephosphonate (-CH2-N-PO3H2)-based scale inhibitors (SIs) have been deployed for preventing various scales in the oil and gas industry, particularly for squeeze treatment applications. However, this class of phosphonate inhibitors showed several limitations related to environmental concerns and compatibility with brine solutions. The low toxicity of low-molecular-weight polyethyleneimine (LMW-PEI) encouraged us to phosphonate a series of branched and linear PEIs via the Moedritzer–Irani reaction. The phosphonated polyethyleneimine PPEIs are branched PPEI-600, branched PPEI-1200, branched PPEI-2000, and linear PPEI-5000. The newly synthesized PPEIs (branched and linear) were screened for calcium carbonate and barium sulfate utilizing a high-pressure dynamic tube-blocking rig at 100 °C and 80 bar. Moreover, we report the compatibility activity of all PPEIs with various concentrations of calcium ions (up to 10000 ppm). The morphology of the calcium carbonate and barium sulfate scale crystals in the absence and presence of linear PPEI-5000 was also investigated under static conditions using scanning electron microscopy (SEM). The obtained results showed that all branched and linear PPEIs gave moderate calcite and barite inhibition activities. It was also found that all branched PPEIs gave moderate to poor calcium compatibility at high dosages of calcium ions (1000–10 000 ppm). Interestingly, linear PPEI-5000 displayed superior compatibility properties at high dosages of SI (up to 50 000 ppm) and high concentrations of Ca2+ ions (up to 10 000 ppm). Furthermore, field emission scanning electron microscopy analysis confirmed that the crystal shapes of CaCO3 and BaSO4 mineral scales are greatly changed in the presence of linear PPEI-5000. At high dosages of linear PPEI-5000 SI (100 ppm), the CaCO3 crystals are completely converted from cubic-shaped blocks (blank calcite) into long cluster shapes. Density functional theory (DFT) simulations reveal favorable interactions of PPEI polymers with the two mineral facets (calcite and barite) with more affinity toward the calcite surface. PPEI with more phosphonate groups exhibits affinities comparable to the commercial-scale inhibitors. The high density of the phosphonate groups on the branched PPEI and its strong affinity toward calcium ions explain its poor calcium compatibility. The polymer flocculation and sluggish barite kinetics are the potential reasons for its low performance against the barite scale.