Plugging (a,b)←(1,1) into the first given condition, we get f(1,1)=1.
On the other hand, by plugging (a,b)←(a,b+1) we get
f(a,b+1)+a+b+1=f(a,1)+f(1,b+1)+ab+a.
Using the first given condition in its original form, it follows that
f(a,b+1)−f(a,b)=f(1,b+1)−f(1,b)+a−1.
Let p>2 be a fixed prime number such that p∣a+b, meaning that p∣f(a,b). Since p∣a+(b+1)−1, we also have p∣f(a,b+1). Therefore, p∣f(1,b+1)−f(1,b)+a−1 and
p∣f(1,b+1)−f(1,b)−b−1(∗)
for all positive integers a and b, and primes p>2 such that p∣a+b.
Note that the right-hand side in (∗) does not depend on a, hence fixing b and varying a would yield infinitely many odd prime divisors of f(1,b+1)−f(1,b)−b−1, which is possible only if the latter equals 0, i.e.
f(1,b+1)=f(1,b)+b+1
for every positive integer b.
Therefore, f(1,2)=f(1,1)+2=1+2, f(1,3)=f(1,2)+3=1+2+3, i.e. f(1,n)=1+⋯+n=2n(n+1) (by mathematical induction).
In a similar fashion, starting with (a,b)←(a+1,b), we infer that f(n,1)=2n(n+1).
Finally, from
f(a,b)+a+b=f(a,1)+f(1,b)+ab=2a(a+1)+2b(b+1)+ab,
it follows that f(a,b)=(2a+b). This function clearly satisfies the second given condition, hence it is the only solution.