An op-amp is not supposed to take any input current into the device through the input terminals and besides, it is designed as some kind of a voltage controlled voltage source. Since it is voltage controlled,we connect a voltage source or a battery at the input. Any voltage source will have a voltage source (Vs) in series with a source resistance (Rs). When this is connected to an op-amp, the Rin (input impedance) comes in series with the source voltage and its resistance. The amplifier takes in only the drop across Rin. The drop across Rin is Rin*Vs/(Rin+Rs). Here, if the Rin is not very large, only a part of the applied input voltage will drop across Rin. So, Rin has to be very very large, ideally infinite for it to take in most of the input voltage. You can observe this in low grade multimetres which when measuring voltage tend to consume almost half the voltage being measured.
In case of Rout (the output impedance), the same reason applies. Rout is in series with a resistance RL (The load resistance). Let the gain of the op-amp be A. So, the voltage at the output will be A*Vs. The output voltage will be read out from the load resistance. So, we need the entire voltage to drop across it. So, here, the voltage drop across RL is A*Vs*RL/(RL+Ro). Here, we'd prefer Ro to be 0 ideally.
Hope it was clear.