What can cause my foot to swell and turn purple?

Several reasons. Other than trauma, the first thing that comes to mind is venous insufficiency, where the valves of the deep leg veins become incompetent, causing the leg veins to become congested with unoxygenated blood, resulting in swelling with a bluish color, while the foot and leg remain warm.