We have employed first principles calculations to study the electronic structure and magnetic properties of the low-dimensional phosphates, Ba2Cu(PO4)2 and Sr2Cu(PO4)2. Using the self-consistent tight-binding lin- earized muffin-tin orbital method and the Nth order muffin-tin orbital method, we have calculated the various intrachain as well as the interchain hopping parameters between the magnetic ions Cu2+ for both the com- pounds. We find that the nearest-neighbor intrachain hopping t is the dominant interaction suggesting the compounds to be indeed one dimensional. Our analysis of the band dispersion, orbital projected band struc- tures, and the hopping parameters confirms that the Cu2+-Cu2+ super-super exchange interaction takes place along the crystallographic b direction mediated by O-P-O. We have also analyzed in detail the origin of short-range exchange interaction for these systems. Our ab initio estimate of the ratio of the exchange inter- action of Sr2Cu(PO4)2 to that of Ba2Cu(PO4)2 compares excellently with available experimental results.