Generally, you must be married for one year before you can get spouse’s benefits. However, if you are the parent of your spouse’s child, the one-year rule does not apply. The same is true if you were entitled (or potentially entitled) to certain benefits under Social Security or the Railroad Retirement Act in the month before the month you got married. A divorced spouse must have been married 10 years to get spouse’s benefits.
See Retirement Benefits: Benefits For Your Spouse for more information.