In this paper, the exact analytical solution of the Susceptible-Infected-Recovered (SIR) epidemic model is obtained in a parametric form. By using the exact solution we investigate some explicit models corresponding to fixed values of the parameters, and show that the numerical solution reproduces exactly the analytical solution. We also show that the generalization of the SIR model, including births and deaths, described by a nonlinear system of differential equations, can be reduced to an Abel type equation. The reduction of the complex SIR model with vital dynamics to an Abel type equation can greatly simplify the analysis of its properties. The general solution of the Abel equation is obtained by using a perturbative approach, in a power series form, and it is shown that the general solution of the SIR model with vital dynamics can be represented in an exact parametric form.