Initially, both the pepper and pin float. One reason is that they are both very light; the other is that water has a kind of thin, invisible ‘skin’ on its surface. Light things do not break this skin, but are supported by it – some animals, e.g. water striders, can even walk on it (see image above). This thin skin is caused by surface tension.
When you added the soap drop, the pepper probably moved away from it and slowly sank. The pin would have sunk immediately.
Why is that? The soap breaks this thin skin of the water – you could also say that soap reduces the surface tension. As the skin disappears, there is nothing left to hold the pepper and the pin on the surface of the water, so they sink. Although this is how it may look, pepper and soap do not repel each other – the tension of the rest of the water (where the soap has not yet reached) pulls the floating pepper away from the soap.