Actually you gave me the idea to do this myself on a site I’m tinkering with. I found the most efficient way was to create this filter:
function add_nav_menu_search($args) {
//ensure it's the nav menu you want to add the search form to
if($args['theme_location'] == 'primary_navigation') {
$args['items_wrap'] = $args['items_wrap'].get_search_form();
}
return $args;
}
add_filter('wp_nav_menu_args', 'add_nav_menu_search', 20);
Then I just style it using LESS mixins or extend the Bootstrap .navbar-form and either .navbar-right or .navbar-left classes: