What should I do when my one ankle hurts when I get up to walk?

Try rice diet. First try rest, ice, compression ( ace wrap), and elevation. If that doesn't help, see your local podiatrist.
Depends . Is the pain from a previous injury. It sounds like it is stiff in the morning. You need to get an x ray to see the condition of the joint. There may be bone spurs that may be contributing to the stiffness.