From the London Review of Books:
Penicillin revolutionised the treatment of staphylococcal infections. But its power over them began to wane soon after its general introduction. The first naturally occurring penicillin-resistant staphylococci were noted by Fleming in 1942. Between April and November 1946, 12.5 per cent of Staphylococcus aureus strains isolated at the Hammersmith Hospital in London were penicillin-resistant. By early 1947 the percentage had tripled. The bacteriologist Mary Barber showed that this rise was not due to the development of resistance while patients were being treated, but to the spread of a penicillin-resistant strain in the hospital. Some staphylococci had the ability to make penicillinase, a penicillin-destroying enzyme. The introduction of penicillin gave them an evolutionary advantage over strains killed by the antibiotic.
Methicillin was developed in response. It was resistant to penicillinase.
More here.