Macular edema can be caused by various underlying conditions such as diabetes, age-related macular degeneration, uveitis, retinal vein occlusion, or after cataract surgery.