You get your MD / DO from your med school. During fourth year you apply for residency in an area of specialty, i.e. internal medicine, family medicine, ER, derm, gen surg, ENT, urology, ON/Byn, neurosurg, neuro, psych, peds, urology, anesthesiology. I think I got most of them, sorry if I forgot anyone.
After completing residency which lasts from 3 to 7 years depending upon the specialty, you then have the option of sub-specializing. I am waiting to see where I match for internal medicine. During my second of three years of IM I will apply for fellowship, probably critical care. To become an intensivist -- a critical care doc-- from IM I can either pursue pulmonary/critical care or just critical care fellowships. It should also be noted that both surgeons and anesthesiologists can also complete critical care fellowships and sit for the critical care boards.
By the time you finish residency you will already have a US license to practice medicine since you will have completed all three steps of the USMLE. After residency you will sit for the appropriate specialty board administered by the appropriate professional licensing body, ABIM in the case of internal medicine. Sub-specialty boards are adminstered by the professional licensing body of that sub-specialty.
Clear as mud?