It depends. Teachers tend to get overwhelmed with endless keepsakes that they just can't keep. Christmas gifts (even for teachers who don't celebrate Christmas) and end-of-year gifts, all the "world's best teacher" mugs, and so on....it gets old, and overwhelming, and guilt-inducing when teachers have to put stuff in yard sales or thrift shops (where they just get bought up for the next found of teachers!). And teaching is a profession, so there's a professional relationship with kids and parents.
If the teacher has been very open with the kids about getting married, and if she will be taking a week or so off from school, then it might be fun to have the kids write a little blurb along the lines of "Rules of Married Life" or "How to have a good marriage." 5th graders are on the line, though, between being little kids and being fairly worldly about things like sex and shared bed, so you have to be very, very careful. Sure, it's fun if they write up funny things (even if they don't realize how funny they are), and it might be the sort of thing the teacher would keep. A writing assignment has some educational value and it may be enlightening in terms of where each kid is in terms of maturation and insight. But if it verges into the inappropriate or a lot of giggling between kids, it's far better not to have brought it up at all.
The final thing is logistics: How will you get everyone involved? Who will supervise this "assignment" or project? Trying to get it done before the wedding means being in the classroom and involving the teacher. Doing it while she's gone is possible, but you need to get involved with the principal and the substitute (and the rest of the team if your 5th graders have teams like ours do), and there may be enough disruption anyway.
I would absolutely not cross the line to buy something from her registry or start collecting donations from other parents to make it a class gift. That's a burden on parents, and it involves yet another financial contribution by parents who already feel that pressure twice a year. At least on those other occasions, you are thanking her for her professional contribution. This is verging on the personal and you must tread carefully. Again, a lot depends on how much she has shared with the kids and the school community in general.