A bi-polar stepper motor looks like this:
As you can see it has two coils and will normally therefore have 4 leads. If you have no documentation for your motor then you can just use an ohmmeter to work out each pair of pins. I.e. 1a and 1b will have a low resistance between them, and 2a and 2b will also have a low resistance. If you measure across two pins and have an infinite resistance then they are from different coils. So once you know which two pins are coil 1 and which are coil 2 then you will still need to find out which are ‘a’ and which are ‘b’ – but more on that later.
To drive the motor then let us consider one of the coils – say coil 1. In order to become an electromagnet we need to be able to change the direction of the current through the coil. So each side of the coil needs to be either or low.
If ‘1a’ is high and ‘1b’ is low then we will have a current through the coil.
If ‘1a’ is low and ‘1b’ is high then we will have a current through the coil in the opposite direction.
In the other two cases: where they are both high, or both low, then no current flows and so it is no longer a magnet.
A suitable circuit to do this as an H-Bridge. As you will see from that link – you need four switches in the H-Bridge to be able to give the four control states we have mentioned above.