Every state--and city--is going to be different in their response to this question. I would imagine that yes, you do have to have a rail, especially if you are building a new home. If it is an older home, then newer laws and codes might not apply. And then, the guidelines for what type of railing, how high, how long, will be pretty specific.
To find the answer to this question go to your city's website. So, if your city is named Springfield, the website will probably be at springfield.org, or you can do a google search to find it. Under your city's website, look for a link that has the different departments under it, and try to find the city planning, zoning, or building inspection departments. They might have information under there. If all else fails, just get the phone number to the city offices, and ask to be transferred to a building inspector. They will know right away the answer to the question.
Another place you could go is to any contractors that you know--people that build houses for a living. They will definitely know the answer to this question. You could ask someone you know, or just go to the yellow pages under contractors and call random ones; they will know, since they have to build the homes under all of the building codes of your city.
I hope that these suggestions lead you in the right direction; good luck!