Will a 4 Ah 12 V battery be fine for a 2 A 12 V diaphragm pump + a Raspberry Pi?
will this [battery] be able to provide a steady voltage


It has a "Cold Cranking Current" rating of 60A, so a pump drawing e.g. 5A starting current will be absolutely no problem.

Since the Pi needs a 5V supply, you need some kind of voltage step-down from the 12V+ battery anyway. A common step-down converter may operate on input down to about 2V above output voltage, so to about 7V for the Pi's 5V. That means that, as long as the battery's voltage does not drop below about 7V during pump start, you will be fine.
And a charged 60A CCC battery in healthy condition should never drop to 7V from a 5A or even 10A current draw.

As to the run times a quick estimation:

Pump:

0.25h/day * 2A = 0.5Ah/day ~ the battery's 4Ah are enough for about 4Ah/0.5Ah/day = 8 days of pump operation.

The Raspberry Pi, if running 24/7, will however consume much more energy:
Optimistically assuming maybe 3W on average, (realistically probably more like 4-6W) that'd be

3W*24h/day = 72Wh/day required for the Pi alone.

The battery holds (somewhat less usable energy than) 12V*4Ah = 48Wh 

So the Pi alone will drain the battery in (much) less than 2/3 of a day (16h).

As others have stated, the Pi is probably way over the top for what you need. A small microcontroller can do many measurement, control and timing tasks as well or even better than a Pi (integrated ADC, less jitter in real-time applications, power save modes with wake-up 'cost' of a few micro- to milli-seconds,...). An AVR ATmega328 (the one also used in the Arduinos) draws about 30mA (at 5V, i.e. 0.15W) when busy. That's already down by a factor of 20-40x from an idle Pi, and, when not busy, can sleep at a fraction of that in deep power save modes.

If you need WiFi you can go for the ESP8266 or the ESP32. They will draw considerable current (couple of hundred mA's) in bursts when "busy" sending/receiving data over the air, but can also use power save modes of a few mA.