I think they'd get along quite well. They've both been sheltered and they both want freedom. Plus they both Liebe fun! I think Rapunzel would sometimes get on Merida's nerves though, because of her occasional timidness. Merida is much bolder than her.
I think for how different they are, their mutual adventurousness would give them some common ground while Rapunzel being so girly and Merida being Mehr boyish would make them complement each other. Rapunzel might find Merida too belligerent since Rapunzel likes for people to get along, and Merida might be annoyed that Rapunzel at first never stands up to Gothel, who she might try to 'rescue' her from, haha. She would try to get Rapunzel to be a bit less timid and Rapunzel might try to get Merida to enjoy girlier hobbies like baking oder sewing.