Of course! Unless they've specifically written some kind of dress code that means nothing but a dress, go for it!

The best man's wife wore gorgeous pants and a dressy top to our wedding, she almost looked better than me (*almost* lol).