P-branes are objects in supergravity and were studied first. They are described by a specific form of the spacetime metric and other background fields in the theory. You can consider them in string theories that have the supergravity theory as a low energy limit. D-branes are p-branes further adapted to the string framework. The "D" stands for "Dirichlet boundary conditions" for the string endpoints on the branes. The fluctuations of the D-branes are considered to be stringy excitations on the brane in contrast to sugra p-branes with (quantum) field fluctuations.
Bergshoeff, Sezgin and Townsend (Phys. Lett. 189B, 1986) first considered p-branes based on observations of Hughes, Liu and Polchinski (Phys Lett B180 1986).
Fundamental strings of string theory are a specific type of 1-brane, "electric", while magnetic 1-branes are solitonic solutions to a given theory. (This is a general thing: An electric 0,1,2,...-brane is not a true solution to a set of equations of motion; rather, they are objects coupling to a singular "solution" of the theory. On the other hand, magnetic branes are true solutions to the equations of motion.