Building and installing SDL for your platform (including how to obtain prebuilt binaries in some cases) is covered in Installation.
The source code to the latest official release of SDL2 is here.
If you want up to the minute bug fixes and improvements, you can track our work in SDL's Git repository:
git clone https://github.com/libsdl-org/SDL.git
We intend official releases to be reasonably stable, and don't promise anything about the quality level of the Git repo from moment to moment, but as official releases tend to happen months apart, you might find a bug that's bothering you is fixed in revision control long before it makes it to a release.
(tl;dr: don't use SDL 1.2)
If you want SDL 1.2, the final released version is 1.2.15. We occasionally collect a fix or two in revision control, but our current intention is to never release an official 1.2.16 build, and while we may accept small patches, we do not intend to ever work on 1.2 again. You should expect it to continue to bitrot over time, and become a liability to your project. The best course of action is to move to SDL 2.0 or later as quickly as possible, and we have put together a migration guide to help with this.
The 1.2.15 source code is here if you must have it.
You can find 1.2's source code in a separate Git repository:
git clone https://github.com/libsdl-org/SDL-1.2.git
This will leave you with an "SDL-1.2" directory with the latest (post-1.2.15) changes to SDL 1.2.
Please note that eventually this branch will become a small compatibility shim that bridges the 1.2 API to a real build of SDL2. Plan accordingly.