Stepper motor and solenoid valve connected to a push button switch

You need to have a variable (perhaps called buttonPressed) and when the physical button is pressed the variable is set to true

buttonPressed = true;

and in your stepper function and your solenoid function you will need code like

if (buttonPressed == true) {
   // code to do stuff

}

You may get some ideas from Planning and Implementing a Program

...R
Stepper Motor Basics
Simple Stepper Code